Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Codeigniter 2 and codeception #13

Closed
evancauwenberg opened this issue Apr 2, 2012 · 4 comments
Closed

Codeigniter 2 and codeception #13

evancauwenberg opened this issue Apr 2, 2012 · 4 comments

Comments

@evancauwenberg
Copy link

Hi
i have a clean CodeIgniter framework version 2 installed.
And created a phpunit test in /tests/unit/PostTest.php with following contents:

CI = &get_instance(); $this->CI->load->database('testing'); } public function testGetsAllPosts() { $this->CI->load->model('post'); $posts = $this->CI->post->getAll(); $this->assertEquals(1, count($posts)); } ``` } and this is my bootstrap: http://conversal.w0p.be/tests/unit/_bootstrap.phps when i run codecept run unit --bedug i get this: Running PostTest::testGetsAllPosts PHP Fatal error: Call to undefined function get_instance() in /var/www/sites/conversal.w0p.be/tests/unit/PostTest.php on line 9 PHP Stack trace: PHP 1. {main}() /usr/bin/codecept:0 PHP 2. Symfony\Component\Console\Application->run() /usr/bin/codecept:39 PHP 3. Symfony\Component\Console\Application->doRun() /usr/share/php/Codeception/vendor/Symfony/Component/Console/Application.php:105 PHP 4. Symfony\Component\Console\Command\Command->run() /usr/share/php/Codeception/vendor/Symfony/Component/Console/Application.php:188 PHP 5. Codeception\Command\Run->execute() /usr/share/php/Codeception/vendor/Symfony/Component/Console/Command/Command.php:227 PHP 6. Codeception\Codecept->runSuite() /usr/share/php/Codeception/src/Codeception/Command/Run.php:57 PHP 7. Codeception\SuiteManager->run() /usr/share/php/Codeception/src/Codeception/Codecept.php:89 PHP 8. Codeception\PHPUnit\Runner->doEnhancedRun() /usr/share/php/Codeception/src/Codeception/SuiteManager.php:130 PHP 9. PHPUnit_Framework_TestSuite->run() /usr/share/php/Codeception/src/Codeception/PHPUnit/Runner.php:97 PHP 10. PHPUnit_Framework_TestSuite->run() /usr/share/php/PHPUnit/Framework/TestSuite.php:705 PHP 11. PHPUnit_Framework_TestSuite->runTest() /usr/share/php/PHPUnit/Framework/TestSuite.php:745 PHP 12. PHPUnit_Framework_TestCase->run() /usr/share/php/PHPUnit/Framework/TestSuite.php:772 PHP 13. PHPUnit_Framework_TestResult->run() /usr/share/php/PHPUnit/Framework/TestCase.php:751 PHP 14. PHPUnit_Framework_TestCase->runBare() /usr/share/php/PHPUnit/Framework/TestResult.php:650 PHP 15. PostTest->setUp() /usr/share/php/PHPUnit/Framework/TestCase.php:801 FATAL ERROR OCCURRED. TESTS NOT FINISHED. it looks like it doens't load the _bootstrap?
@DavertMik
Copy link
Member

Sorry, bootstrap files work only with native Cest or Cept formats.
I think I should improve Codeception to make loading of boostrtap file into Test files too.
Thanks for your report.

@evancauwenberg
Copy link
Author

oke so i should rewrite the unit test to a cest?

@DavertMik
Copy link
Member

No, there is no need in doing so. All the formats should be equal.
I will try to release a patch which fixes boostrtap for Test files today.

@evancauwenberg
Copy link
Author

great !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants