Updated simplest app scenario (HelloWorld)#90
Conversation
dalehhirt
left a comment
There was a problem hiding this comment.
Can you leave a link to the Hello World test file?
|
If you wanted to test this place the entire folder from HelloWorld.zip into pftt2/cache. Otherwise, if you were just looking for the test file, it is in there as well. |
|
Nice @lavturo, thanks! A next step might be to turn that into a server test (i.e. remove the Also, I wonder where to put the test file for future usage. |
|
@cmb69 @dalehhirt Could you guys check this again? I have updated it to use phpunit-5 for now. There were some workarounds I implemented (mostly in I was also able to remove a decent amount of files from the cache folder as well since pftt2 will not need those files anymore to run phpunit. However, keep in mind that phpunit-5 only supports 5.6, 7.0, 7.1. So if we were to do more app testing, we would have to change it get the appropriate phpunit (which right now it seems phpunit-7 is the only other one we need to get to support up to 7.4). I just want some feedback about how it is currently being implemented. Adjustments can be made. |
|
@cmb69 I believe I made the current test file into a server test based on what you said. Is it correct? |
With "server test" I meant to actually run with some Webserver, not to include the file from the filesystem. However, that would probably be a step too much for now, and including 'HelloWorld.php" like you did is fine. After all, we now have the first working app test! :) A minor issue: at first I used a PHP without php.ini, and PHPUnit-5.7.27\autoload.php wasn't generated (even though "Created autoload.php" was reported). I think we should catch this, and give a helpful error message (or at least don't go on with the tests). Could you have a look at that please? |
|
My mistake. Hopefully we can work towards that. As for the issue, you're correct. The autoload generator (phpab) says that it needs the following extensions enabled:
However, I tested with only the FileInfo extension enabled and it seems to work. So I updated the files to reflect that. |
@cmb69 @dalehhirt Please look over the changes. Overall, there are not too many big changes, just changes that were enough to get the HelloWorld scenario to work.
If you want specifics:
-
CliPhpUnitTestCaseRunner.javawas preventing pftt2 from running since it kept giving an error about php.ini not found.-
PhpUnitSourceTestPack.javahad some issues finding some tests since pftt2 has all the paths with a forward-slash instead of back-slash.-
hello_world.groovywas implemented to run the simplest scenario. Kind of gives an idea of how other app scenarios should be structured (wordpress.groovyis probably a better one to reference)-
DOMDocument.phpwas giving an error regarding assertEquals function not being compatible with another assertEquals*. Updated for the time being. When/if we upgrade PHPUnit, this shouldn't be needed anymore. It is temporary for this function to work.*Full error message
[Fatal error: Declaration of PHPUnit_Framework_Comparator_DOMDocument::assertEquals($expected, $actual, $delta = 0, $canonicalize = false, $ignoreCase = false) must be compatible with PHPUnit_Framework_Comparator_Object::assertEquals($expected, $actual, $delta = 0, $canonicalize = false, $ignoreCase = false, array &$processed = Array) in C:\pftt2\cache\util\PEAR\pear\PHPUnit\Framework\Comparator\DOMDocument.php on line 115]