Tagged Questions
4
votes
0answers
396 views
phpunit restarting tests randomly
I am trying to test my symfony2 application using PHPUnit. I got one project where everything works as expected, but on my other project I have this strange behaviour that PHPUnit either stops ...
1
vote
0answers
29 views
Setting HTTP headers to be able to run test cases
I am using phpunit. I want to test my code which basically gets parameters from HTTP headers and use it to perform subsequent operations.
But while testing the headers are null.
Is there any way ...
1
vote
0answers
16 views
How to test a class that depends on an external collection in PHPUnit?
One of my classes, Foo, has a method, Foo::bar(), that relies on an injected collection, BazCollection, and values extracted from that collection's items. I need to unit test Foo::bar(), and I can't ...
1
vote
0answers
82 views
Missing DbAdapter dependencies in Zend Framework 2 PHPUnit
I have a very simple controller action
<?php
namespace Application\Controller;
use Zend\Mvc\Controller\AbstractActionController;
use Zend\View\Model\ViewModel;
class IndexController extends ...
1
vote
0answers
44 views
Phpunit does not execute effective parent test case?
I'm currently testing a wrapper to an API with PHPUnit (CLI).
Due to the nature of the tests, I can pretty much use the same code for testing two different use cases. The only difference is in the ...
1
vote
0answers
43 views
assertHeader in Zend_Test_PHPUnit_ControllerTestCase not working?
I started to write some unit test for an app in zend framework.
Looking around I came to the PHPunit and then to the Zend_Test (which in turn extends the PHPunit).
So I opted to write tests with ...
1
vote
0answers
117 views
Re-using datasets in PHPUnit
I have a user object with property 1, property 2, and property 3. I have a separate function to edit each property. Therefore, I'll need to test each edit property function. So I'll create 3 ...
1
vote
0answers
434 views
PHPUnit + Symfony 1.4 + Doctrine: Best practice of fixture loading
I am trying to get my PHPUnit Database Tests in place for my Symfony 1.4 on Doctrine.
Unfortunately I don't know the best practice for this. Everything I try seems to have disadvantages.
What I ...
0
votes
0answers
19 views
Symfony2: Getting security context from with in a controller during a test
I'm trying to test a function in my controller that requires the security.context service. In my test I log in using a made up token as shown bellow:
public function testAccountType()
{
...
0
votes
0answers
19 views
Mock Code Igniter's function
Well I have to test a function in Signup Class like this.
Class Signup extends CI_Controller {
public function testMe(){
$value = $this->input->get('value'); // This input class is ...
0
votes
0answers
21 views
PHPUnit and Code Coverage - How Much?
I have a Model layer in an MVC application and I'm testing it with PHPUnit. When it comes to code coverage, I could either maximise the overlap between tests, or minimise it. I am trying to get an ...
0
votes
0answers
12 views
How can I create test-suites to run on VisualPHPUnit?
I am using VisualPHPUnit and I am trying to organize my tests into suites (due to the fact that Selenium IDE does not export PHPUnit test suites).
I am currently implementing the option of the ...
0
votes
0answers
36 views
building and testing a new ZF2 application
I've been following ZF2 tutorials on where/how to write unit tests for modules while I'm writing an application. Right now each module has its own test dir with its own Bootstrap.php and phpunit.xml ...
0
votes
0answers
19 views
Test Array of Objects using PHPUnit Mocking
I wanted to test using mocking whether the method in the called class returns an array of objects. I searched on the internet for something similar to find, but none meets my requirement.
Here is ...
0
votes
0answers
20 views
phpUnit Test Report Error
I am having an error while I was trying to setup phpUnit Test report from this site. I did what was asked and added index to test folder but it is showing error. Everything is working fine when I ...