PHPUnit is the de facto standard for writing unit tests for PHP code.

learn more… | top users | synonyms

6
votes
0answers
724 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 ...
4
votes
0answers
170 views

Travis CI timeout when generating code coverage for PHP

I'm trying to get Travis CI to output a coverage report to be used with scrutinizer later. But I'm having trouble to get it to work. When I add --coverage-clover=coverage.clover to my phpunit ...
3
votes
0answers
22 views

webtests symfony 2.5 with Fosuserbundle

I try make test with authentication fosuserbundle, but still is fail, i find solution for symfony 2.3 but it doesn't works https://gist.github.com/deltaepsilon/6391565 i also try create client by ...
3
votes
0answers
387 views

PHPUNIT Selenium 2 key “enter” submit wrong form in Firefox 22

Until now my testcase working fine on FF21 but after i updated to FF22 when im using "enter" button he submit all form instead of this element which is on focus. There is part of my "code" ...
3
votes
0answers
150 views

Phpunit functional tests follow redirection to external site

I have to write functional tests with PhpUnit (and Selenium) for an e-commerce application. How can I follow redirection to PayPal page, submit an order, and follow redirection from PayPal to my ...
3
votes
0answers
2k views

“headers already sent” Error returned during PHPUnit tests

I'm testing a suite of REST web services with PHPUnit. We're using output buffering in order to gzip-encode the responses. When I run a test for the service with PHPUnit, I'm getting the error: ...
2
votes
0answers
33 views

Database unit test bound to implementation detail

I have a simple PHP-Class that wraps the access to the database to retrieve a user and want to unit-test it. I currently have the following code: The class to test: class UserTable { protected ...
2
votes
0answers
36 views

PHPUnit - autoload classes within tests

I have the following structure within my project: / /app /app/models/ --UserTable.php /lib /lib/framework /lib/framework/Models /lib/framework/Db /tests -- phpunit.xml, bootstrap.php /tests/app ...
2
votes
0answers
79 views

PHPUnit not providing any output

phpunit used to work just fine, providing the number of assertions, errors... But then i was trying to install skeleton generator for netbeans with pear, and things got messed up a bit (i had to ...
2
votes
0answers
223 views

Symfony, doctrine Unit of work undefined index in WebTestCase

I want to test my action in the controller for uploading a file. However the file needs a "farm" which is a parent entity. So I am creating the farm with all subentities before calling the request in ...
2
votes
0answers
125 views

pcntl_fork() usage in PHPUnit tests

I have some problem with pcntl_fork() usage in PHPUnit. I'm executing this code class ForkTest extends PHPUnit_Framework_TestCase { public function test1() { print('Start test with pid ...
2
votes
0answers
155 views

PHPUnit - The test case was unexpectedly terminated: Debug Error: Class not found: Interface not found

I get this class of error: Debug Error: Class/Interface not found And more abstract one from PHPUnit: The test case was unexpectedly terminated. Specific Example: Debug Error: ...
2
votes
0answers
722 views

how to mock laravel eloquent model

I keep fumbling over this - how do I mock a model that extends form Eloquent in Laravel 4 for my unit test? I keep getting the following error w/ my current way ErrorException: Trying to get ...
2
votes
0answers
66 views

Is there a way to assert file is not empty in PHPUnit?

I am writing a unit a test for a method which is supposed to be able to locate a file and write to it. PHPUnit has methods to compare two files, whether it exists or not, however I am not able to find ...
2
votes
0answers
161 views

Zend Framework 2 Database Tests create connection

I cant find any Source on the Internet which can explain how to set up a Database Test in ZendFramework 2 with PHPUnit. I have UnitTests running for my Model, but cant find any Source which describes ...
2
votes
0answers
161 views

EcomDev Phpunit tests called twice during execution

I am trying to run few unit test cases and I see that they are being run twice in each run, I am not sure of the reason though. The following is my test case structure - class ...
2
votes
0answers
195 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 ...
2
votes
0answers
69 views

Test access_control in Symfony2

I want to test that my access_control is working as expected, that certain roles don't have access to a page while other roles do. I can do this using Functional Tests, logging in each user and ...
2
votes
0answers
780 views

Setup PHPUnit for netbeans and xampp

I'm struggling to setup PHPUnit (3.7.20) in netbeans (7.3) and xampp. When I create a new project with code under C:\xampp\htdocs, I can run a test in netbeans without problems. However I usually ...
2
votes
0answers
148 views

PHPUnit - Remote Code Coverage

I have a full REST project. Test cases call the REST APIc through cURL. How can I add this request to code coverage report? I know that PHPUnit-Selenium can collect code coverage report through ...
2
votes
0answers
1k views

Test Doctrine ODM respository with phpunit in Symfony2

I want to test this simple query: public function findArticlesByUsers($ids) { $qb = $this->createQueryBuilder(); $qb ...
2
votes
0answers
233 views

Doctrine mongo ODM duplicating embedded documents in Symfony

Using Doctrine mongo ODM 1.0.0-BETA8 in Symfony 2.2.1, I'm running into troubles with the update portion of CRUD. Upon persist() the new embedded documents are being duplicated. I ran the phpunit ...
2
votes
0answers
199 views

Selenium 2 phpunit move jquery ui slider

How to move jQuery UI slider with PHPunit selenium 2? I was not able to do it by using dragandrop function.
2
votes
0answers
287 views

Selenium RC PHPUnit test

My testcase crashes with the following error: $this->open("/en"); $this->type("id=LoginForm_username", "seleniumfree"); $this->type("id=LoginForm_password", ...
2
votes
0answers
373 views

Make netbeans use virtual box guest installation of phpunit

We use netbean's phpunit / unit testing plugins for all our testing. We used to use xampp and point netbeans at our our .bat file from the xampp installation. We recently started using vagrant and ...
2
votes
0answers
378 views

Silex phpunit not matching routes

I am trying to write some tests for my Silex app and have run into an issue. I have the following phpunit.xml file <?xml version="1.0" encoding="UTF-8"?> <phpunit ...
2
votes
0answers
105 views

Erroneous failure running PHPT with PHPUnit on PHP 5.4.6

PHPUnit runs regular tests without trouble, but it mistakenly reports this basic PHPT example as failing when it should pass: --TEST-- strtr() function - basic test for strstr() --FILE-- <?php /* ...
2
votes
0answers
122 views

NetBeans custom script

I want to select one of more files in the NetBeans project navigator and it execute a single shell script, so if I selected MyClass.php and MyOtherClass.php it would run a script like (and show the ...
2
votes
0answers
271 views

PHPUnit & Selenium code coverage - coverage metrics stop halfway through test

I'm just getting started with PHPUnit and Selenium, yet one problem has been bothering me: I can't seem to get correct coverage figures. My app takes a user through a multi-step process that ...
2
votes
0answers
228 views

selenium driver, option inside optgroup fails to execute

I am using the PHP webdriver bindings here: http://code.google.com/p/php-webdriver-bindings/ I can select standard option elements in a <select> no problem, but when they are a child of an ...
1
vote
0answers
28 views

How to setup HHVM for PHPUnit in PhpStorm

How could I run my unit tests in PhpStorm 8 with HHVM as its interpreter? PhpStorm 8 supports PHPUnit 4 which that supports HHVM and I could run my test suite on termianl with HHVM but I do not know ...
1
vote
0answers
22 views

PHPUnit_Extensions_Database_Testcase returns undefined method

Im getting a Fatal error: Call to undefined method PHPUnit_Extensions_Database_DB_DefaultDatabaseConnection::prepare() on a phpunit test where I'm preparing a PDO statement. If the default database ...
1
vote
0answers
22 views

PHPUnit and namespaces - mocked methods still being called

I am adding unit tests to an existing project that is using namespaces. I haven't ever had to use namespaces before, so it is somewhat of an adventure. My issue is that in my unit tests, it appears ...
1
vote
0answers
28 views

Working authentication in functional testing

This example is not working: http://symfony.com/doc/current/cookbook/testing/simulating_authentication.html $session = $this->client->getContainer(); in login function return null. Is any actual way ...
1
vote
0answers
117 views

Netbeans 8.0.1 with PHPUnit and Skeleton generator

I have installed Netbeans together with PHPUnit and phpunit-skeleton-generator from homebrew. I can generate a testfile from the terminal by running phpunit-skelgen --test -- "UrlDecoder" ...
1
vote
0answers
46 views

Unittests running twice in parent class

For many good reasons I put some tests into parent test class und some tests in inhereted class. I have got this structure then: /bar/foo/foo.php /bar.php This command I use to start phpunit: ...
1
vote
0answers
17 views

How can I dump all guzzle responses into txt files?

I've been reading the documentation: http://guzzle3.readthedocs.org/testing/unit-testing.html and I know how to use .txt files as response mocks for testing; but what I want to achieve is to grab ...
1
vote
0answers
35 views

Mocking a GuzzleHttp response

How should I mock a Guzzle response properly. When testing a parser I'm writing, the test html is contained in files. In my PHPUnit tests I'm doing file_read_contents and passing the result into my ...
1
vote
0answers
20 views

unittest laravel caching issue

I am using laravel 4 and created a class under its own namespace. Within this class there's a method that retrieves data and caches it. I also wrote a very small unit test to check if caching works. ...
1
vote
0answers
67 views

Why would PHP's stat throw a RuntimeException?

Is there a reason why a call to stat would throw a RuntimeException? This is during testing with phpunit, using CakePHP and PHP-VCR. The call to stat includes the error control operator, @. So it's: ...
1
vote
0answers
36 views

PHPunit - Missing class, although autoload.php is loaded

I've got the following file structure: includes class.Klasse.php src autoload.php tests KlasseTest.php This structure is within a project folder. On the linux shell, being in this folder, I ...
1
vote
0answers
195 views

Filling in Mask Fields __.__.__.___.__ with PHP Unit selenium webdriver

Using the PHPUnit Selenium from Sebastian Bergmann( Facebook WebDriver ) Current code to select and fill in the user_insz field With $search7a = ...
1
vote
0answers
53 views

Phpunit runs in shell but fails in Jenkins'

When I run PhpUnit tests in shell, they run OK, but when run from Jenkin's build step (Execute Shell), it fails with: [workspace] $ /bin/sh -xe /tmp/hudson3868615221631158667.sh + phpunit --log-junit ...
1
vote
0answers
31 views

Class Memcache not found when executing in PHPUnit

I have installed the memcached and loaded the memcached extension, but when I was runnning a test with PHPUnit, it told class memcached not found. Can anyone tell me why, and how to solve it?
1
vote
0answers
18 views

unit tests for a class that parses a DOM Document and requires a path to a xml file

I have been writing a comparison application for wsdl files in php. For this I load the wsdl file into a DOM Document object and parse the file using a wsdl class called WSDLFactory. I have created a ...
1
vote
0answers
41 views

Laravel unittest migrate vendor package with SQLite

I've added to the sentry package this migration: use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class AddFieldsUsers extends Migration { /** * Run ...
1
vote
0answers
39 views

PHPUnit ReturnCallback when using cloned objects

I am finding extremely difficult to modify mock objects that are cloned by the class I am testing. Here is my test: $firstDocument = array('type' => 'venue', 'name'=> "first venue"); ...
1
vote
0answers
12 views

phpunit selectlink not working

I am having an issue with my unit test where i am attempting to select a link. the issue is that the name of the link is very similar to other link names and therefore it is not getting the correct ...
1
vote
0answers
56 views

How to test a shared Symfony 2 Bundle without a full project

As we start using Symfony 2 on several projects now, we find that there is quite a bit of code we could share among our projects. So we started extracting features into Symfony 2 bundles in order to ...
1
vote
0answers
124 views

PHPUnit Selenium fail to run phantomjs/ghostdriver test

I start grid service - java -jar selenium-server-standalone-2.42.1.jar -role hub I start phantomjs - phantomjs --webdriver= --webdriver-selenium-grid-hub={hubip/port} I run phpunit and the output ...