PHP Fatal error: Class 'CTestCase' not found in - php

Just trying to run a simple test on my local box but i get the following error:
PHP Fatal error: Class 'CTestCase' not found in ....
when running
$ phpunit UserTest
I guess my configuration must be missing something? I just can't figure out what.
Using:
OSX 10.6.7
PHP 5.3.4
PHPUnit 3.5.13
Yii 1.1.7

Make sure you run phpunit at the same directory where your phpunit.xml is. :)

The error message is telling you that the class CTestCase cannot be located. PHPUnit accepts an --include-path option on the command line. You could try something like this:
$ phpunit --include-path .:/path/to/dir/containing/CTestCase UserTest

I found the solution for me. But i am not sure whether this works for you all or not.
Here is the url for the solution
http://www.yiiframework.com/forum/index.php/topic/4728-running-unit-tests-on-windows-problem/

Related

PHP Fatal error: Class 'Bllim\Datatables\DatatablesServiceProvider'

I'm a newbie in Laravel. I just cloned my co-worker git and try to php artisan list but it gives me error
PHP Fatal error: Class 'Bllim\Datatables\DatatablesServiceProvider' not found in /Users/path-to-project/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php on line 157
I can't find any documentations about this error and search results don't really help.
Any of you ever met this problem and care to help me fix this? Thank you.
Asking your coworker would be a first good step :)
That said, the error you're getting indicates that PHP can't find or autoload a Laravel Service provider class. If your coworker is following Laravel best practices, you should be able to fix this by running the following command from your root project directory (or the directory with a composer.json file)
$ composer install
or ...
$ composer.phhar install
The format of the command (phar or no phar) will depend on how you've installed composer, the dependency/package manager used in Laravel.

PHPUnit with Symfony Fatal error: Class 'Doctrine\Bundle\DoctrineBundle\DoctrineBundle' not found

I'm trying to testing my app made with Symfony. I wrote a test and when I launch it, i get the following error:
Fatal error: Class 'Doctrine\Bundle\DoctrineBundle\DoctrineBundle'
not found in /.../app/AppKernel.php on line 17
I had the same error with Symfony's MonologBundle, AsseticBundle and SwiftmailerBundle: then I've manually added these bundles into my app, so pheraps I have fixed those errors, but with Doctrine I've not found any solutions yet.
It looks like maybe you did not install the Doctrine bundle.
Try to go to the root of your project where the composer.phar is located through a console, and try to run it like this:
php composer.phar
It will install all dependencies of Symfony2,and hopefully everything is going to work :)

PHPUnit test failed

I'm currently trying to run PHPUnit on my Ubuntu 12.04 virtual machine and when I run phpunit under my application root that has phpunit.xml.dist file it reads from the config but I'm getting below error and it fails:
PHP Fatal error: Call to undefined method PHPUnit_Util_Test::getHookMethods() in phar:///usr/bin/phpunit/phpunit/Framework/TestSuite.php on line 633
Is there a reason why this is happening?
I had a similar issue in a different environment.
The problem was that another library's loader was registered too early which also contained another version of PHPUnit which had no that method. The proper order of autoloaders solved the problem.

FatalErrorException: ParameterBag in Symfony2

I just installed Symfony2 in my local server using XAMPP, and fixed all the recommendation extensions- APC and intl.
When I tried to access http://localhost/symblog/web/app_dev.php/. I got the following error.
FatalErrorException: Error: Class
'Symfony\Component\DependencyInjection\ParameterBag\ParameterBag' not
found in
/Applications/XAMPP/xamppfiles/htdocs/symblog/app/bootstrap.php.cache
line 2469
I don't know what's wrong with it. I try to googling but It doesn't have any information. Any suggestion would be appreciated.
Seems like you cache is broken or dependencies are missing. Try:
php app/console cache:clear
If nothing changes, try:
php composer.phar install

PHPUnit StackTest::assertEmpty() deprecated

I am learning building php unit tests using PHPUnit . There they have a manual and I encountered this example Where they use assertEmpty(), but when I run this code in command line I get this error : Call to undefined method StackTest::assertEmpty() in /var/www/.../tests/StackTest.php on line 20. So if this method is deprecated or something why they use it , also is there another method for this? (of course I can try this $this->assertEquals(0, count($stack));) but anyways...
The same with assertNotEmpty().
I'm on debian, and it looks like the default install of PHPunit is a bit old (3.4.14).
If you search for "assertEmpty" in this url, you will see what version it was added in (3.5.0-1).
http://packages.debian.org/changelogs/pool/main/p/phpunit/phpunit_3.6.10-1/changelog.html
What worked for me was removing phpunit from the system with apt, and installing it with pear
http://www.santiagolizardo.com/article/how-to-install-pear-and-phpunit-in-debianubuntu/57001
These links also helped me.
"Fatal error: Call to undefined method PHPUnit_Util_Filter::addfiletofilter() in /usr/bin/phpunit on line 48"
Cannot get PHPunit working
Are you running the unit test from the command line with the phpunit command line tools?
phpunit --verbose StackTest stacktest.php

Categories