Unit Testing a Zend Framework
Questions tagged [zend-test]
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…

Nick
- 21
- 5
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 =
'
Test paragraph.
'; $domDoc = new…
gurghet
- 7,591
- 4
- 36
- 63
1
vote
1 answer
How to use zend test phpunit in zend project
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…
user707549
1
vote
0 answers
Phpunit using zend framework 3 and doctrine, Mocking not working
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…

Aamir
- 2,173
- 1
- 29
- 58
1
vote
0 answers
PHPUnit\Framework\Error\Warning: ini_set(): Headers already sent. You cannot change the session module's ini settings at this time
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…

Nathália Pissuti
- 179
- 17
1
vote
0 answers
PHPUnit tests ignored, when a class constant is in use
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…

automatix
- 14,018
- 26
- 105
- 230
1
vote
2 answers
Object Mocking - How to replace a factory with a service in the service manager?
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…

halfpastfour.am
- 5,764
- 3
- 44
- 61
1
vote
3 answers
PHPUnit/Zend_Test: PDOException: You cannot serialize or unserialize PDO instances
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…

Jiew Meng
- 84,767
- 185
- 495
- 805