Questions tagged [zend-test]

Unit Testing a Zend Framework

51 questions
7
votes
1 answer

Zend Framework (PHPUnit) Tests won'r run (phpunit: command not found / Class 'PHPUnit_Framework_TestCase' not found)

i installed PHPUnit by the book: sudo pear channel-discover pear.phpunit.de sudo pear install phpunit/PHPUnit The include path is added in the /etc/php5/cli/php.ini include_path = ".:/usr/share/php" $ ls /usr/share/php/PHPUnit/ Extensions …
Hannes
  • 8,147
  • 4
  • 33
  • 51
7
votes
3 answers

How can I in PHP re-create my Database (for Unit Testing for example)

How can I from PHP, re-create my Database, maybe inserting default data. Currently, I am intending to use the behavior for Unit Tests. I am using Doctrine 2, Zend Framework 1.11, Zend_Test for unit tests I could use the CLI doctrine…
Jiew Meng
  • 84,767
  • 185
  • 495
  • 805
6
votes
2 answers

Zend_Controller_Router_Exception: Route default is not defined

I'm trying to test a controller. Zend Tool has generated the following code: class Default_CarrinhoControllerTest extends Zend_Test_PHPUnit_ControllerTestCase { public function setUp() { $this->bootstrap = new Zend_Application(APPLICATION_ENV,…
dextervip
  • 4,999
  • 16
  • 65
  • 93
6
votes
1 answer

PHP ZF2 Unit Tests dispatch method very slow

I need to test a big site written in ZF2. There is 443 test and about 10000 assertions. Testing with code coverage takes 6 hours! I think I found the problem: In controller's tests I use a dispatch method from AbstractHttpControllerTestCase. Time of…
Kudlaty
  • 61
  • 3
6
votes
1 answer

Setup PHPUnit with Zend Test

I'm trying to start using PHPUnit with Zend Test for my Zend Framework application. I'm able to run the PHPUnit command from command line phpunit --configuration phpunit.xml. I've tried following this tutorial which is based off of Matthew Weier…
nwalke
  • 3,170
  • 6
  • 35
  • 60
6
votes
4 answers

Running PHP Zend Test in Eclipse

Is it possible to run PHP Zend test cases (those that extend Zend_Test_PHPUnit_ControllerTestCase, etc.) through Eclipse PDT? I would like to be able to run them in a similar fashion as you run JUnit tests in Eclipse, by right-clicking the test file…
Carlos Eiroa
5
votes
1 answer

Unit testing with Zend Framework/Doctrine 2.0

I wanted to write unit tests for my Zend Framework/Doctrine 2.0 application, but I don't quite understand how to set up unit testing in ZF. Also, I would like to include Doctrine 2.0 in those unit tests. How would I go about setting this up? Can you…
clarkstachio
  • 613
  • 4
  • 8
4
votes
0 answers

session_start(): Failed to read session data: user (path: ) -in phpUnit and zend-test

We are very new with setting up test automation for out zf2 application. We use the test classes of zend-test (AbstractHttpControllerTestCase) since it's a zend application. We run it through phpUnit inside vagrant. Everything was going well so far…
helloUser
  • 41
  • 3
3
votes
1 answer

Phpunit Error - failed asserting node denoted by

I am using PHPUnit 3.5.x along with Zend 1.10 I have a line in my IndexControllerTestCase.php $this->assertXpathContentContains("id('message')", "test message"); this shows an error 1) IndexControllerTest::testIndexWithMessageAction Failed…
Srivathsa
  • 941
  • 1
  • 10
  • 27
3
votes
3 answers

(PHP): Testing models with Zend_Test_PHPUnit_DatabaseTestCase

When I run my PHP unit test I get: 1) Test_Model_Mapper_TestTest::testTest Argument 1 passed to PHPUnit_Extensions_Database_DataSet_DefaultTableIterator::__construct() must be an array, null given, called in…
moteutsch
  • 3,741
  • 3
  • 29
  • 35
3
votes
2 answers

Zend_Test: No default module defined for this application

UPDATE 23 Dec I had the problem where Zend Framework complains about "No default module defined for this application". I didn't use Modules and the main app works fine. I finally solved the problem with the help from weierophinney.net Your…
Jiew Meng
  • 84,767
  • 185
  • 495
  • 805
3
votes
3 answers

class PHPUnit\Framework\ExpectationFailedException not found

when I try to run a failed test with this command : ./vendor/bin/phpunit I get this Fatal Error : PHPUnit 5.7.20 by Sebastian Bergmann and contributors. PHP Fatal error: Class 'PHPUnit\Framework\ExpectationFailedException' not found in…
3
votes
1 answer

Code coverage fails with PHPUnit and the Zend Framework

I have some issues with code coverage reports in PHPunit and the zend framework. Whenever I run a phpunit test the code coverage fails returning the following message: PHPUnit 3.4.15 by Sebastian…
2
votes
1 answer

Unit Testing with Zend_Test: Call to a member function hasResource() on a non-object in Zend's ErrorController

I am getting this error Fatal error: Call to a member function hasResource() on a non-object in D:\Projects\Tickle\application\controllers\ErrorController.php on line 53 where line 53 looks like if (!$bootstrap->hasResource('Log')) { It seems…
Jiew Meng
  • 84,767
  • 185
  • 495
  • 805
2
votes
2 answers

Unit Testing Doctrine 2 Models

Whats the way to unit test Doctrine 2 models? I am using it with Zend Framework 1.11. It has Zend_Test which uses PHPUnit. I think the right thing to use is PHPUnit_Extensions_Database_TestCase. In Zend Framework, I can use Zend_Test_PHPUnit_Db. How…
Jiew Meng
  • 84,767
  • 185
  • 495
  • 805
1
2 3 4