Using Composer for development environment

Discussions and requests related to new CMSimple features, plugins, templates etc. and how to develop.
Please don't ask for support at this forums!
Post Reply
cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Using Composer for development environment

Post by cmb » Thu May 15, 2014 3:35 pm

Hello Community,

since a while ago I have written several unit tests that require components which cannot be installed via PEAR, namely phpunit-mockfunction and version 1.x of vfsStream, but can easily be installed and kept up-to-date with Composer. As both components greatly help resp. allow to bring huge parts of our codebase under test at all, I assume you have no objections.

To make it easier for others to run the tests using these components, I suggest to commit composer.json and composer.lock to our SourceForge repository; currently I have them on my machine only, ignored by SVN.

What do you think? Any need to vote?

Christoph
Christoph M. Becker – Plugins for CMSimple_XH

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Using Composer for development environment

Post by cmb » Thu May 15, 2014 9:50 pm

Hm, just learned that PHPUnit drops support for PEAR installation: http://pear.phpunit.de/.
Christoph M. Becker – Plugins for CMSimple_XH

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Using Composer for development environment

Post by cmb » Mon May 19, 2014 2:04 pm

cmb wrote:What do you think? Any need to vote?
Hm, no feedback so far. I've put it on the 1.6.3 roadmap for voting.
Christoph M. Becker – Plugins for CMSimple_XH

svasti
Posts: 1651
Joined: Wed Dec 17, 2008 5:08 pm

Re: Using Composer for development environment

Post by svasti » Fri Jun 20, 2014 7:06 pm

cmb wrote:Hm, no feedback so far.
because it's higher esoterics.

manu
Posts: 1086
Joined: Wed Jun 04, 2008 12:05 pm
Location: St. Gallen - Schweiz
Contact:

Re: Using Composer for development environment

Post by manu » Wed Jun 25, 2014 2:19 pm

cmb wrote:To make it easier for others to run the tests using these components, ...
Is there a quick how-to use these test sequences?

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Using Composer for development environment

Post by cmb » Wed Jun 25, 2014 3:51 pm

manu wrote:Is there a quick how-to use these test sequences?
No, unfortunately not, because the "details" of setting up the tools depend on the system, and Windows could be rather messy in this regard.

However, it's quite simple if you already have Phing, PHPUnit (I'm still using 4.0.x via PEAR, but a newer version should also work), Runkit and Composer installed. Then you have to create the following composer.json in the root folder:

Code: Select all

{
    "require-dev": {
        "tcz/phpunit-mockfunction": "1.0.0",
        "mikey179/vfsStream": "1.2.0"
    }
}
and install the libraries:

Code: Select all

composer install
After that you can run the unit tests:

Code: Select all

phing unit-tests
Christoph M. Becker – Plugins for CMSimple_XH

Holger
Site Admin
Posts: 3470
Joined: Mon May 19, 2008 7:10 pm
Location: Hessen, Germany

Re: Using Composer for development environment

Post by Holger » Fri Jun 27, 2014 8:00 am

cmb wrote:I suggest to commit composer.json and composer.lock to our SourceForge repository...

What do you think? Any need to vote?

Christoph
+1 IMO no need to vote.

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Using Composer for development environment

Post by cmb » Sun Sep 14, 2014 3:47 pm

Hello Community,

I have added some of the development dependencies to composer.json -- actually, all dependencies that are available via packagist. Furthermore I have updated the existing dependencies. (r1369+r1370) Some of the test assertions have been deprecated a while ago; for now I have silenced these assertions, but we will have to replace them ASAP, or use a PHPUnit extension that serves as drop-in replacement; as the latter might save a lot of work, we should keep an eye on https://github.com/phpunit/phpunit-dom-assertions.
cmb wrote:
manu wrote:Is there a quick how-to use these test sequences?
No, unfortunately not, because the "details" of setting up the tools depend on the system, and Windows could be rather messy in this regard.
I have created an article regarding the setup of a development environment in the Wiki. I presume I have forgotten some important details, so it would be good if others could verify the explanations, and fix or improve them.

Christoph
Christoph M. Becker – Plugins for CMSimple_XH

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Using Composer for development environment

Post by cmb » Wed Jun 01, 2016 1:30 pm

cmb wrote:Some of the test assertions have been deprecated a while ago; for now I have silenced these assertions, but we will have to replace them ASAP, or use a PHPUnit extension that serves as drop-in replacement; as the latter might save a lot of work, we should keep an eye on https://github.com/phpunit/phpunit-dom-assertions.
This issue (assertTag()) is becoming somewhat urgent, because PHPUnit 4 will reach its EOL on August 7, 2016, and unfortunately there doesn't seem to be further development on phpunit-dom-assertions (and I'm not aware of an alternative).

While some of the affected tests are real unit tests, some are not (they're more like acceptance tests). So I tend to replace the latter with real end-to-end tests (Selenium seems to be a suitable platform for that), and to remove the respective PHPUnit tests completely. In the long run it would be great to have full code coverage with unit tests, but for now I don't see any reasonable way to do so.

Anyhow, would anybody be willing to help to write Selenium tests? For a start, SeleniumIDE tests might be sufficient.
Christoph M. Becker – Plugins for CMSimple_XH

Post Reply