[eluser]n0-0ne[/eluser]
HI I’ve just downloaded CIUnit 0.17 to unit test my code igniter application.
PHPUnit version 3.4.3
CI version 1.7.2
I’m now learning CI and built a really simple blog model class (doesn’t really do any thing yet)
but when I try to test it I get the Fatal error that the class has already been declared
Code:
$ phpunit --verbose AllTests.php
Fatal error: Cannot redeclare class Blog_modelTest in /var/www/CodeIgniter/system/application/tests/models/blog_model_test.php on line 16
Call Stack:
0.0004 61944 1. {main}() /usr/bin/phpunit:0
0.1269 4480512 2. PHPUnit_TextUI_Command::main() /usr/bin/phpunit:52
0.1269 4481244 3. PHPUnit_TextUI_Command->run() /usr/share/php/PHPUnit/TextUI/Command.php:147
0.1290 4484292 4. PHPUnit_Runner_BaseTestRunner->getTest() /usr/share/php/PHPUnit/TextUI/Command.php:168
0.1291 4484516 5. PHPUnit_Runner_BaseTestRunner->loadSuiteClass() /usr/share/php/PHPUnit/Runner/BaseTestRunner.php:112
0.1291 4485004 6. PHPUnit_Runner_StandardTestSuiteLoader->load() /usr/share/php/PHPUnit/Runner/BaseTestRunner.php:170
0.1294 4519536 7. PHPUnit_Util_Fileloader::checkAndLoad() /usr/share/php/PHPUnit/Runner/StandardTestSuiteLoader.php:102
0.1294 4519796 8. PHPUnit_Util_Fileloader::load() /usr/share/php/PHPUnit/Util/Fileloader.php:91
0.1298 4533212 9. include_once('/var/www/CodeIgniter/system/application/tests/AllTests.php') /usr/share/php/PHPUnit/Util/Fileloader.php:113
0.1709 6438416 10. require_once('/var/www/CodeIgniter/system/application/tests/models/ModelsAllTests.php') /var/www/CodeIgniter/system/application/tests/AllTests.php:19
the test code itself is also very simple -
Code:
<?php
include_once dirname(__FILE__).'/../CIUnit.php';
class Blog_modelTest extends CIUnit_TestCase {
public function setUp() {
$this->CI->load->model('Blog_model');
}
function testGet_entries()
{
$this->assertEquals(10, count($this->blog->get_entries));
}
}
any idea why this would happen ?