-
Notifications
You must be signed in to change notification settings - Fork 0
OSS PHP Frameworks Unit Testing: Kohana 3.3
Kohana is an elegant HMVC PHP5 framework that provides a rich set of components for building web applications.
The framework will stand out of the rest because of its Cascading File System running HHVM.
Excerpt from the Extension-API:
For the simplest implementations, you can just write pure PHP code which will be built into your HHVM binary (as a block called SystemLib) and loaded persistently for all requests... To add your own function or class to SystemLib, place the implementation under
hphp/system/php
, and reference it fromhphp/system/php.txt
. From here, the next time you compile HHVM, it will be included in the binary as part of the runtime.
It is possible to put the Kohana system, or any framework in SystemLib, and it will be just part of HHVM.
However, Kohana's advantage is that, when you list the system files in hphp/system/php.txt
, you want to list only transparently implemented classes, the ones that go deeper in folder hierarchy with the Kohana_
prefix. Then, you can still develop your application(s), overriding whatever class you need, through the Cascading File System!
Download the latest master branch from Github
The documentation to run the unit tests are found here: http://kohanaframework.org/3.3/guide/unittest/testing
We followed the instructions for running the tests at the command line (see the "Usage" in the link above). Below are some additional steps we took to get the tests running correctly.
In order to run the Kohana unit tests successfully, make sure you have HHVM, Composer and other basic packages ready to go.
To set initial configuration for Kohana, its enough to set the cookie salt in bootstrap.php.
A Kohana module to fix specific parts of the framework to make Kohana more compatible with HHVM.
birkir/kohana-hhvm is a standard module that can be enabled in bootstrap.php. Please read how to enable a module in Kohana.
Link:
http://github.com/birkir/kohana-hhvm
To run the Kohana unit tests, use the following command from the root Kohana directory (sudo
may be necessary):
[sudo] hhvm vendor/bin/phpunit --bootstrap=modules/unittest/bootstrap.php modules/unittest/tests.php
Failed asserting that false matches expected true.
Failed asserting that false matches expected true.
Failed asserting that false matches expected true.
Failed asserting that two arrays are equal.
Kohana_DateTest::test_formatted_time with data set #4 ('2011-04-01 01:23:45 Antarctica/South_Pole', '@1301574225', 'Y-m-d H:i:s e', 'Antarctica/South_Pole')
Failed asserting that two strings are identical.
Failed asserting that false is true.
Failed asserting that Array() is identical to an object of class "ReflectionProperty".