Questions tagged [zend-test]

Unit Testing a Zend Framework

51 questions
2
votes
1 answer

"No such file or directory" SQLSTATE error using PHPUnit with XAMPP & Zend Framework

The error I'm getting is below. Zend_Db_Adapter_Exception: SQLSTATE[HY000] [2002] No such file or directory I've tried setting the xampp php to be the php in my PATH, hoping that it's a configuration file, but I had no luck with that. I'm not…
Dan G
  • 1,090
  • 1
  • 11
  • 20
2
votes
1 answer

How to start testing Zend Framework Models?

How do I begin testing my models in a Zend Framework 1.8+ application? Let's say I have my application set up to start testing. I have already tested a controller, so I know it works. I have all my controllers extending my ControllerTestCase.php…
Andrew
  • 227,796
  • 193
  • 515
  • 708
2
votes
1 answer

How to assert multiple attribute element in Zend_Test?

For example: How can I assert this input? $this->assertQuery( "input[name="user_name][type='hidden']") can not find any content. Of couse $this->assertQuery( "input[name='user_name']) will work well, but I need to use type and name attributes…
kelly
  • 41
  • 3
2
votes
2 answers

using zend test dbadapter with zend db table abstract

Has anyone been able to to use Zend_Test_DbAdapter with Zend_Db_Table_Abstract? I'm trying to test a Model I created that extends Zend_Db_Table_Abstract and I get an exception regarding the primary key not being set if I use a Zend_Test_DbAdapter…
2
votes
1 answer

How to assert the full response, not just the"view" part using Zend_Test_PHPUnit?

I want to test that my /login page is working well and rejecting invalid credentials i.e. not redirecting to the user's dashboard and showing an aller message identified here with the .alert HTML class. So I've created a test like this: class…
Mauro
  • 3,946
  • 2
  • 27
  • 41
2
votes
1 answer

Unit Test Zendframework: Failed saving metadata to metadataCache

I am trying to setup a controller unit test but I get the following error: InscricaoControllerTest::testInscricaoPage() Zend_Controller_Exception: Failed saving metadata to metadataCache#0 [internal function]:…
dextervip
  • 4,999
  • 16
  • 65
  • 93
1
vote
1 answer

PHPunit, Getting function code coverage for a ZF controller action

I'm using PHPunit to test our Zend Framework project and it works allright but i'm not getting coverage om my action methods in my controllers. Although I get coverage in number off lines of code but I want to have coverage on the…
Kees Schepers
  • 2,248
  • 1
  • 20
  • 31
1
vote
1 answer

How to manipulate the application configs for controller tests?

I'm writing functional / controller tests for a ZF3 application (driven by PHPUnit and zendframework/zend-test). Like this: public function testWhatEver() { $this->dispatch('/'); …
automatix
  • 14,018
  • 26
  • 105
  • 230
1
vote
2 answers

XPath in PHPUnit testing with Zend

I have this apparently basic code: $docSrc = ' </head> <body><p>Test paragraph.</p></body> </html>'; $domDoc = new…</div> <div class="grid ai-start jc-space-between fw-wrap"> <div class="grid gs4 fw-wrap tags "> <a href="../../questions/tagged/unit-testing" class="post-tag grid--cell" title="show questions tagged 'unit-testing'" rel="tag">unit-testing</a> <a href="../../questions/tagged/zend-framework" class="post-tag grid--cell" title="show questions tagged 'zend-framework'" rel="tag">zend-framework</a> <a href="../../questions/tagged/phpunit" class="post-tag grid--cell" title="show questions tagged 'phpunit'" rel="tag">phpunit</a> <a href="../../questions/tagged/zend-test" class="post-tag grid--cell" title="show questions tagged 'zend-test'" rel="tag">zend-test</a> </div> <div class="started mt0"> <div class="s-user-card s-user-card"> <time class="s-user-card--time" datetime="asked May 13 '11 at 19:35">asked May 13 '11 at 19:35</time> <a href="../../users/440237/gurghet" class="s-avatar s-avatar__32 s-user-card--avatar"> <img class="s-avatar--image" src="../../users/profiles/440237.webp" data-jdenticon-width="32" data-jdenticon-height="32" data-jdenticon-value="gurghet" /> </a> <div class="s-user-card--info"> <a href="../../users/440237/gurghet" class="s-user-card--link">gurghet</a> <ul class="s-user-card--awards"> <li class="s-user-card--rep" title="reputation score">7,591</li> <li class="s-award-bling s-award-bling__gold" title="4 gold badges">4</li> <li class="s-award-bling s-award-bling__silver" title="36 silver badges">36</li> <li class="s-award-bling s-award-bling__bronze" title="63 bronze badges">63</li> </ul> </div> </div> </div> </div> </div> </div> </div> <div class="mln24"> <div class="question-summary" id="question-summary-5660446"> <div class="statscontainer"> <div class="stats"> <div class="vote"> <div class="votes"> <span class="vote-count-post"><strong>1</strong></span> <div class="viewcount">vote</div> </div> </div> <div class="status answered-accepted"> <strong>1</strong> answer </div> </div> </div> <div class="summary"> <h3><a href="../../questions/5660446/how-to-use-zend-test-phpunit-in-zend-project" class="question-hyperlink">How to use zend test phpunit in zend project</a></h3> <div class="excerpt">I am a very new zend framework and phpunit test learner. I have a zend project, I want to use the zend-test-phpunit to test the model and controllers under the application folder. How could I test it? I notice there is a tests folder in this…</div> <div class="grid ai-start jc-space-between fw-wrap"> <div class="grid gs4 fw-wrap tags "> <a href="../../questions/tagged/zend-test" class="post-tag grid--cell" title="show questions tagged 'zend-test'" rel="tag">zend-test</a> </div> <div class="started mt0"> <div class="s-user-card s-user-card__deleted"> <time class="s-user-card--time" datetime="asked Apr 14 '11 at 08:24">asked Apr 14 '11 at 08:24</time> <div class="s-avatar s-avatar__32 s-user-card--avatar"> </div> <div class="s-user-card--info">user707549</div> </div> </div> </div> </div> </div> </div> <div class="mln24"> <div class="question-summary" id="question-summary-54593922"> <div class="statscontainer"> <div class="stats"> <div class="vote"> <div class="votes"> <span class="vote-count-post"><strong>1</strong></span> <div class="viewcount">vote</div> </div> </div> <div class="status "> <strong>0</strong> answers </div> </div> </div> <div class="summary"> <h3><a href="../../questions/54593922/phpunit-using-zend-framework-3-and-doctrine-mocking-not-working" class="question-hyperlink">Phpunit using zend framework 3 and doctrine, Mocking not working</a></h3> <div class="excerpt">I'm using zend-test in zf3, using doctrine, when I run the test for PostController showAction(),it is showing following error $ vendor/bin/phpunit --testsuite Post --stderr PHPUnit 7.5.2 by Sebastian Bergmann and contributors. F 1 / 1…</div> <div class="grid ai-start jc-space-between fw-wrap"> <div class="grid gs4 fw-wrap tags "> <a href="../../questions/tagged/php" class="post-tag grid--cell" title="show questions tagged 'php'" rel="tag">php</a> <a href="../../questions/tagged/zend-framework" class="post-tag grid--cell" title="show questions tagged 'zend-framework'" rel="tag">zend-framework</a> <a href="../../questions/tagged/doctrine" class="post-tag grid--cell" title="show questions tagged 'doctrine'" rel="tag">doctrine</a> <a href="../../questions/tagged/phpunit" class="post-tag grid--cell" title="show questions tagged 'phpunit'" rel="tag">phpunit</a> <a href="../../questions/tagged/zend-test" class="post-tag grid--cell" title="show questions tagged 'zend-test'" rel="tag">zend-test</a> </div> <div class="started mt0"> <div class="s-user-card s-user-card"> <time class="s-user-card--time" datetime="asked Feb 08 '19 at 13:55">asked Feb 08 '19 at 13:55</time> <a href="../../users/4794920/aamir" class="s-avatar s-avatar__32 s-user-card--avatar"> <img class="s-avatar--image" src="../../users/profiles/4794920.webp" data-jdenticon-width="32" data-jdenticon-height="32" data-jdenticon-value="Aamir" /> </a> <div class="s-user-card--info"> <a href="../../users/4794920/aamir" class="s-user-card--link">Aamir</a> <ul class="s-user-card--awards"> <li class="s-user-card--rep" title="reputation score">2,173</li> <li class="s-award-bling s-award-bling__gold" title="1 gold badge">1</li> <li class="s-award-bling s-award-bling__silver" title="29 silver badge">29</li> <li class="s-award-bling s-award-bling__bronze" title="58 bronze badge">58</li> </ul> </div> </div> </div> </div> </div> </div> </div> <div class="mln24"> <div class="question-summary" id="question-summary-53051173"> <div class="statscontainer"> <div class="stats"> <div class="vote"> <div class="votes"> <span class="vote-count-post"><strong>1</strong></span> <div class="viewcount">vote</div> </div> </div> <div class="status "> <strong>0</strong> answers </div> </div> </div> <div class="summary"> <h3><a href="../../questions/53051173/phpunit-framework-error-warning-ini-set-headers-already-sent-you-cannot-change" class="question-hyperlink">PHPUnit\Framework\Error\Warning: ini_set(): Headers already sent. You cannot change the session module's ini settings at this time</a></h3> <div class="excerpt">I'm following zend's tutorial to use zend-test on my project, but I'm getting this error. To build my project's base I did the biggest part of this book. I'm also using PHP 7.2. When I search google I found a lot of people having trouble using PHP…</div> <div class="grid ai-start jc-space-between fw-wrap"> <div class="grid gs4 fw-wrap tags "> <a href="../../questions/tagged/phpunit" class="post-tag grid--cell" title="show questions tagged 'phpunit'" rel="tag">phpunit</a> <a href="../../questions/tagged/zend-framework3" class="post-tag grid--cell" title="show questions tagged 'zend-framework3'" rel="tag">zend-framework3</a> <a href="../../questions/tagged/php-7.2" class="post-tag grid--cell" title="show questions tagged 'php-7.2'" rel="tag">php-7.2</a> <a href="../../questions/tagged/zend-test" class="post-tag grid--cell" title="show questions tagged 'zend-test'" rel="tag">zend-test</a> </div> <div class="started mt0"> <div class="s-user-card s-user-card"> <time class="s-user-card--time" datetime="asked Oct 29 '18 at 17:50">asked Oct 29 '18 at 17:50</time> <a href="../../users/10128482/nathalia-pissuti" class="s-avatar s-avatar__32 s-user-card--avatar"> <img class="s-avatar--image" src="../../users/profiles/10128482.webp" data-jdenticon-width="32" data-jdenticon-height="32" data-jdenticon-value="Nathália Pissuti" /> </a> <div class="s-user-card--info"> <a href="../../users/10128482/nathalia-pissuti" class="s-user-card--link">Nathália Pissuti</a> <ul class="s-user-card--awards"> <li class="s-user-card--rep" title="reputation score">179</li> <li class="s-award-bling s-award-bling__bronze" title="17 bronze badges">17</li> </ul> </div> </div> </div> </div> </div> </div> </div> <div class="mln24"> <div class="question-summary" id="question-summary-45683232"> <div class="statscontainer"> <div class="stats"> <div class="vote"> <div class="votes"> <span class="vote-count-post"><strong>1</strong></span> <div class="viewcount">vote</div> </div> </div> <div class="status "> <strong>0</strong> answers </div> </div> </div> <div class="summary"> <h3><a href="../../questions/45683232/phpunit-tests-ignored-when-a-class-constant-is-in-use" class="question-hyperlink">PHPUnit tests ignored, when a class constant is in use</a></h3> <div class="excerpt">I'm writing integration tests with PHPUnit 6.2.2 and zendframework/zend-test 3.1.0 for a Zend Framework 3 application and observing following behavior: When I define a constant in a test class, e.g. use…</div> <div class="grid ai-start jc-space-between fw-wrap"> <div class="grid gs4 fw-wrap tags "> <a href="../../questions/tagged/php" class="post-tag grid--cell" title="show questions tagged 'php'" rel="tag">php</a> <a href="../../questions/tagged/phpunit" class="post-tag grid--cell" title="show questions tagged 'phpunit'" rel="tag">phpunit</a> <a href="../../questions/tagged/zend-framework3" class="post-tag grid--cell" title="show questions tagged 'zend-framework3'" rel="tag">zend-framework3</a> <a href="../../questions/tagged/zend-test" class="post-tag grid--cell" title="show questions tagged 'zend-test'" rel="tag">zend-test</a> </div> <div class="started mt0"> <div class="s-user-card s-user-card"> <time class="s-user-card--time" datetime="asked Aug 14 '17 at 21:22">asked Aug 14 '17 at 21:22</time> <a href="../../users/2019043/automatix" class="s-avatar s-avatar__32 s-user-card--avatar"> <img class="s-avatar--image" src="../../users/profiles/2019043.webp" data-jdenticon-width="32" data-jdenticon-height="32" data-jdenticon-value="automatix" /> </a> <div class="s-user-card--info"> <a href="../../users/2019043/automatix" class="s-user-card--link">automatix</a> <ul class="s-user-card--awards"> <li class="s-user-card--rep" title="reputation score">14,018</li> <li class="s-award-bling s-award-bling__gold" title="26 gold badges">26</li> <li class="s-award-bling s-award-bling__silver" title="105 silver badges">105</li> <li class="s-award-bling s-award-bling__bronze" title="230 bronze badges">230</li> </ul> </div> </div> </div> </div> </div> </div> </div> <div class="mln24"> <div class="question-summary" id="question-summary-45099568"> <div class="statscontainer"> <div class="stats"> <div class="vote"> <div class="votes"> <span class="vote-count-post"><strong>1</strong></span> <div class="viewcount">vote</div> </div> </div> <div class="status "> <strong>2</strong> answers </div> </div> </div> <div class="summary"> <h3><a href="../../questions/45099568/object-mocking-how-to-replace-a-factory-with-a-service-in-the-service-manager" class="question-hyperlink">Object Mocking - How to replace a factory with a service in the service manager?</a></h3> <div class="excerpt">I'm having some trouble getting my unit test to work. I'm testing a controller that uses a service that is created by a factory. What I want to achieve is to replace a factory with a mocked service so I can perform tests without using an active…</div> <div class="grid ai-start jc-space-between fw-wrap"> <div class="grid gs4 fw-wrap tags "> <a href="../../questions/tagged/php" class="post-tag grid--cell" title="show questions tagged 'php'" rel="tag">php</a> <a href="../../questions/tagged/unit-testing" class="post-tag grid--cell" title="show questions tagged 'unit-testing'" rel="tag">unit-testing</a> <a href="../../questions/tagged/phpunit" class="post-tag grid--cell" title="show questions tagged 'phpunit'" rel="tag">phpunit</a> <a href="../../questions/tagged/zend-framework3" class="post-tag grid--cell" title="show questions tagged 'zend-framework3'" rel="tag">zend-framework3</a> <a href="../../questions/tagged/zend-test" class="post-tag grid--cell" title="show questions tagged 'zend-test'" rel="tag">zend-test</a> </div> <div class="started mt0"> <div class="s-user-card s-user-card"> <time class="s-user-card--time" datetime="asked Jul 14 '17 at 09:35">asked Jul 14 '17 at 09:35</time> <a href="../../users/540812/halfpastfour-am" class="s-avatar s-avatar__32 s-user-card--avatar"> <img class="s-avatar--image" src="../../users/profiles/540812.webp" data-jdenticon-width="32" data-jdenticon-height="32" data-jdenticon-value="halfpastfour.am" /> </a> <div class="s-user-card--info"> <a href="../../users/540812/halfpastfour-am" class="s-user-card--link">halfpastfour.am</a> <ul class="s-user-card--awards"> <li class="s-user-card--rep" title="reputation score">5,764</li> <li class="s-award-bling s-award-bling__gold" title="3 gold badges">3</li> <li class="s-award-bling s-award-bling__silver" title="44 silver badges">44</li> <li class="s-award-bling s-award-bling__bronze" title="61 bronze badges">61</li> </ul> </div> </div> </div> </div> </div> </div> </div> <div class="mln24"> <div class="question-summary" id="question-summary-4471802"> <div class="statscontainer"> <div class="stats"> <div class="vote"> <div class="votes"> <span class="vote-count-post"><strong>1</strong></span> <div class="viewcount">vote</div> </div> </div> <div class="status answered-accepted"> <strong>3</strong> answers </div> </div> </div> <div class="summary"> <h3><a href="../../questions/4471802/phpunit-zend-test-pdoexception-you-cannot-serialize-or-unserialize-pdo-instanc" class="question-hyperlink">PHPUnit/Zend_Test: PDOException: You cannot serialize or unserialize PDO instances</a></h3> <div class="excerpt">I am getting the exception PDOException: You cannot serialize or unserialize PDO instances when I am trying to use PHPUnit for Unit Tests. I have not much going on. I am using Zend Framework 1.11. I guess it maybe that I have Bootstrapped my…</div> <div class="grid ai-start jc-space-between fw-wrap"> <div class="grid gs4 fw-wrap tags "> <a href="../../questions/tagged/zend-framework" class="post-tag grid--cell" title="show questions tagged 'zend-framework'" rel="tag">zend-framework</a> <a href="../../questions/tagged/phpunit" class="post-tag grid--cell" title="show questions tagged 'phpunit'" rel="tag">phpunit</a> <a href="../../questions/tagged/doctrine-orm" class="post-tag grid--cell" title="show questions tagged 'doctrine-orm'" rel="tag">doctrine-orm</a> <a href="../../questions/tagged/zend-test" class="post-tag grid--cell" title="show questions tagged 'zend-test'" rel="tag">zend-test</a> </div> <div class="started mt0"> <div class="s-user-card s-user-card"> <time class="s-user-card--time" datetime="asked Dec 17 '10 at 15:09">asked Dec 17 '10 at 15:09</time> <a href="../../users/292291/jiew-meng" class="s-avatar s-avatar__32 s-user-card--avatar"> <img class="s-avatar--image" src="../../users/profiles/292291.webp" data-jdenticon-width="32" data-jdenticon-height="32" data-jdenticon-value="Jiew Meng" /> </a> <div class="s-user-card--info"> <a href="../../users/292291/jiew-meng" class="s-user-card--link">Jiew Meng</a> <ul class="s-user-card--awards"> <li class="s-user-card--rep" title="reputation score">84,767</li> <li class="s-award-bling s-award-bling__gold" title="185 gold badges">185</li> <li class="s-award-bling s-award-bling__silver" title="495 silver badges">495</li> <li class="s-award-bling s-award-bling__bronze" title="805 bronze badges">805</li> </ul> </div> </div> </div> </div> </div> </div> </div> <div class="s-pagination pager fr"> <a class="s-pagination--item" href="../../questions/tagged/zend-test_page=1" rel="prev" title="Go to page 1">Prev </a> <a class="s-pagination--item" href="../../questions/tagged/zend-test_page=1" rel="" title="Go to page 1">1</a> <div class="s-pagination--item is-selected">2</div> <a class="s-pagination--item" href="../../questions/tagged/zend-test_page=3" rel="" title="Go to page 3">3</a> <a class="s-pagination--item" href="../../questions/tagged/zend-test_page=4" rel="" title="Go to page 4">4</a> <a class="s-pagination--item" href="../../questions/tagged/zend-test_page=3" rel="next" title="Go to page 3"> Next</a> </div> </div> </div> </div> </div> <script src="../../static/js/stack-icons.js"></script> <script src="../../static/js/fromnow.js"></script> </body> </html>