Requirements ¶
Yii 1.1 or above
Instalation ¶
Copy the extracted files in protected/extensions In protected/tests create a new file boot.php with the following content:
<?php
// file boot.php
$yiit=dirname(__FILE__).'/path/to/yii/yiit.php';
$config=dirname(__FILE__).'/../config/test.php';
require_once($yiit);
Yii::createWebApplication($config);
?>
Create in protected/tests/unit a new file exp: main.php and add this code:
<?php
require_once '/../boot.php';
Yii::import('ext.EnhancePHP.*');
// Find the tests - '.' is the current folder
EnhancePHPCore::discoverTests('.', true);
// Run the tests
EnhancePHPCore::runTests();
?>
Run Tests Create a simple test in protected/tests/unit folder exp:
class ExempleTest extends EnhancePHPTestFixture {
public function setUp() {
}
public function tearDown() {
}
public function add1plus1(){
$sum = 1 + 1;
EnhancePHPAssert::areIdentical(2, $sum);
}
}
?>
and run in CLI
cd path/to/your/application/protected/tests/unit
php -f main.php
More examples -> https://github.com/tofan-andrei/yii-EnhancePHP/tree/master/Self-Test
Basic usage ¶
Just replace \Enhance\ with EnhancePHP exp: \Enhance\Core::runTests(); will become EnhancePHPCore::runTests();
Acknowledgement ¶
This framework (Enhance PHP Framework) in not written by me, is written by Steve Fenton * http://www.enhance-php.com/ , i just refactored the code to work well with Yii Framework.
Version ¶
version 1.0 - Enhance Test Framework v2.1.2
Brilliant plugin - but why is the English translation class partly in Romanian?!
Thanks for your hard work on this plugin - it works a treat! I hope you can keep it up to date as EnhancePHP is actively being improved.
But I noticed that even though the plugin is set to be in English by default, running the tests spits out what I think is Romanian. Having investigated it, the following lines of code are held inside the EnhancePHPTextEn class:
public $FormatForTestRunTook = 'Testul a durat {0} secunde'; public $FormatForExpectedButWas = 'Se astepta {0} dar a returnat {1}'; public $FormatForExpectedNotButWas = 'Nu se astepta {0} dar a returnat {1}';
These lines should be:
public $FormatForTestRunTook = 'Test run took {0} seconds'; public $FormatForExpectedButWas = 'Expected {0} but was {1}'; public $FormatForExpectedNotButWas = 'Expected NOT {0} but was {1}';
It should be really easy to create a class specifically for Romanian and then contribute it to the original project instead of overwriting the default language file. It made things a little confusing at first!
Re: Brilliant plugin - but why is the English translation class partly in Romanian?!
Sorry, i forgot to change that, i will fix the class immediately.
Thanks for notice the problem.
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.