Tagged Questions
18
votes
1answer
6k views
Symfony 2 + Doctrine 2 + PHPUnit 3.5: Serialization of closure exception
I tried to find something about this on Google but nothing came out. I have a TestCase class that inherits from WebTestCase, with some methods that I want to use in all my unit/functional tests:
...
18
votes
2answers
3k views
How to set up database-heavy unit tests in Symfony2 using PHPUnit?
I am quite new to the world of testing and I want to make sure I am on the right track.
I am trying to setup unit tests in a symfony2 project using phpunit.
PHPUnit is functional and the simple ...
14
votes
1answer
2k views
Is it possible, using PHPUnit mock objects, to expect a call to a magic __call() method?
I've got a mock object in a test. The real object, PageRepository, implements a magic method using __call(), so if you call $pageRepository->findOneByXXXX($value_of_field_XXXX), it will search the ...
8
votes
2answers
2k views
How to test Symfony2 models using PHPUnit
I've been trying to test a model in a Symfony2 project, but I don't know how to get the entity manager to save and retrive records.
Can anyone point me to the right docs for this?
Thanks
7
votes
1answer
2k views
How to use an authenticated user in a Symfony2 functional test?
I use the FacebookBundle to authenticate users in my Symfony2 application. However, I would like to create functional tests with phpunit which uses an authenticated user.
Moreover, I don't want to ...
6
votes
2answers
148 views
Class __PHP_Incomplete_Class has no unserializer
I am trying to run the tests in PHPUnit and getting this error.
Fatal error: Uncaught exception 'ErrorException' with message 'Class
__PHP_Incomplete_Class has no unserializer' in ...
6
votes
1answer
644 views
symfony2 application, vagrant & ant: stty: standard input: Invalid argument
I am trying to move my development environment (symfony2 application) from my windows 7 localhost to a virtual machine using vagrant and the default ubuntu 10.04 64 bit machine. Everything is set up ...
5
votes
2answers
1k views
Get environment inside controller
I have a situation in one of my controllers that should only be accessed via AJAX, I have the following code.
if (!$request->isXmlHttpRequest()) {
$response = new Response();
...
5
votes
1answer
1k views
PHPUnit, Interfaces and Namespaces (Symfony2)
I'm currently working on an open source bundle for Symfony2, and really want it to be the dogs nadgers in terms of unit test coverage and general reliability, however I've run into a snag due to my ...
5
votes
1answer
3k views
PHPUnit test case aware of symfony2 dependency injection container
I'm actually testing a bundle that I created. All the code is fully unit tested but now, I want to test if my symfony2 services can be request without any trouble.
For that, I need the symfony2 ...
4
votes
2answers
1k views
How can I get IDE autocomplete for PHPUnit?
I am using Symfony2, everything is installed, my tests work so good so far.
I'd like to get an autocompletion of PHPUnit's methods.
Symfony's WebTestCase class extends from ...
4
votes
1answer
2k views
PHPUnit problem - no error messages
I've been trying to solve this problem for quite some time.
I have a simple PHPUnit test case with 2 tests. When I run it, I get this output:
PHPUnit 3.5.14 by Sebastian Bergmann.
.
So the first ...
4
votes
2answers
342 views
PHPUnit's TextUI/command.php not found
I installed phpunit for my symfony2 project following this:
How to use phpunit installed from composer?
But I get the following error now:
Warning: include(C:\Program Files ...
4
votes
2answers
2k views
Run PHPUnit tests of Symfony 2 application under Netbeans 7.1
I've spent some time to figure out how to configure Netbeans 7.1 to work with Symfony 2 and PHPUnit, but I didn't succeed. When I try to run any test under console, there is no problem. But when ...
4
votes
1answer
68 views
PDO connection is not closed when phpunit is running with symfony 2.X
We have about 180 unit tests implement webtestcase class and tests are running over controllers.
However when we run the unit tests, they open too many connection to db. Because of too many active ...