Tagged Questions
0
votes
2answers
84 views
Does phpunit use a different php.ini file than the one configured in MAMP?
I'm trying to run some functional tests using phpunit in Symfony2.
When I run my test, I get this error:
PDO::__construct(): [2002] No such file or directory (trying to connect via ...
0
votes
0answers
21 views
Complete solution for importing hiererchical XML into MySql
I find it easy to describe my test data using hierarchical XML, that is, where each field is its own element (rather than being attributes of the row). But I can't find an elegant way to get it in to ...
1
vote
1answer
110 views
PHPUnit reuse PDO connection
I've been digging around for a few hours now but I can't find a way to recycle a single PDO connection (MySQL) over multiple unit tests. Is there such an animal?
It seems like I should declare it ...
0
votes
2answers
154 views
PHPUnit/DBUnit - createDefaultDBConnection() not accepting schema name
I am working on using PHPUnit/DBUnit to test the interaction with a database. Thus far, I have been unable to get past creatDefaultDBConnection(). The database has already been created in MySQL, and I ...
6
votes
2answers
447 views
Laravel & PHPUnit : allow process isolation to prevent Mysql Too many connections error
Since four months we build a complex web app with Laravel 4 with a good unit test coverage. Now we have 159 tests and 592 assertions to prevent against regression and allow us to easily refactor our ...
0
votes
1answer
76 views
Issue with cakePHP running unit tests
I've have the weirdest issue while trying to test something in my cakePHP 2.0 app. I have a function inside a model that queries the database to check if the app has already sent a notification in the ...
-1
votes
2answers
83 views
Retrieving Month from DATE field in MY SQL
Iam using DATE TYPE to store Date of birth in MY Sql database,
I need to retrieve Month 12 from the following date 2012-12-25
My field name is DOB and I know retrieving MONTH is, using the query ...
0
votes
1answer
176 views
PHPUnit/DbUnit “Too many connections”
While running PHPUnit tests, a lot of connections are created but not closed.
I can see this in
mysql> show processlist;
In my database class I create a db connection by implementing ...
0
votes
0answers
30 views
PHPUnit Database testing doesnt fully run the function to test
I have a PHPUnit test case that test a function that does a range of manipulation with the MySQL database.
When I run the test via PHPUnit the function is not fully run, MySQL database is failed to ...
0
votes
0answers
201 views
PHPUnit Mock Database Connection Class
I'm adding unit tests to legacy codes in a MVC framework. I have a model class called DbConnection that initiate all the database connection, it looks like this:
class DbConnection
function ...
0
votes
0answers
55 views
ZF PHPUNIT Stored Procedure
i googled this and searched stackoverflow for it.
But i only got the hint "put it in a standalone function and mock it in the test".
Assuming this, its meant as a function which i simulate than with ...
1
vote
2answers
105 views
PHPUnit and mysqli_connect generate warning
I'm new to unit testing and want to start using for a large project I'm working on. I've got PHPUnit running on my Mac (10.8.3) alongside MAMP. The application I'm writing unit tests for relies ...
0
votes
0answers
55 views
Phpunit - table comparison fails due to sort
I use the following to test 4 database table against expected output (loaded from an XML file).
$tables_to_compare = array(
'table1',
'table2',
'table3',
'table4'
...
2
votes
2answers
320 views
Slow PHPUnit Tests
I am running PHPUnit to test a CodeIgniter application using CIUnit (a third party interface between the two). A number of the tests select data from an empty MySQL database that is populated with ...
0
votes
0answers
79 views
Performance for PHPUnit fixtures import on MySql
I am trying to make a faster approach on the fixture data by importing all on a script using:
$cmd='mysql -u '.$user.' -p'.$pass.' '.$db.' < '.$file;
The engine of all of the tables is InnoDb, ...
1
vote
2answers
338 views
PHPUnit Testing a select in a method with dataset
I try to test a method that makes a SELECT query and return the rows found. I would like to check that this method doesn't return something else, given a dataset. I found so many docs about creating ...
0
votes
1answer
136 views
How can i test multiple queries result with phpunit
I am a bit new in phpunit, after hours of researching I am not quite find a way. How can I test function getResults using phpunit.
the function getResults and getResultsDetails belong to Result ...
0
votes
1answer
334 views
Zend Framework, PHPUnit and transactions
i want to use PHP Unit inside a Zend Framework application. I need to make several database writing operations inside the tests.
I want to start an MySQL transaction in the setUpBeforeClass() method. ...
1
vote
1answer
282 views
PHPUnit undefined function mysql_connect()
When I try to connect to my MySQL database from PHP code all seems to be fine, all queries are executed successfully. However, when the code is tested with unit tests in PHPUnit, I get the following ...
6
votes
2answers
2k views
PHPUnit and MySQL truncation error
I am getting a headache with PHPUnit's behavior of always running TRUNCATE prior to inserting fixtures without first setting foreign key checks off:
Syntax error or access violation: 1701 Cannot ...
2
votes
2answers
1k views
How to test PHP PDO Singleton Class?
PHP PDO Singleton Class:
<?php
require_once('app/config.php'); // Require constants HOST, DATABASE, USER, PASSWORD
/*
dbConnection class.
Manages connections to and operations on the database. ...
0
votes
1answer
463 views
Error while running phpunit test in yii framework
I just tried to run the unit test of the blog for the yii framework. But I got such error and i am not able to resolve the problem. Please feel free to share with me. Thank you in advance. And I got ...
1
vote
1answer
253 views
PHPUnit DBUnit for integration testing a class that queries a MySQL stored procedure
I have created a YAML dump of my database, which has test data in it. I want to be able to load that data into an empty test database, at the start of each test using the getDataSet() and ...
1
vote
1answer
173 views
How to set up PHPUnit test framework without running on Dev server?
I don't have control of the Dev server, and may not be able to install or use PHPUnit on it. I installed PHPUnit 3.6 locally on my machine and it requires requires PHP 5.2.7 (or later). But the Dev ...
1
vote
2answers
242 views
testing database with binary type in mysql using phpunit
I try to write tests using php for database. I have a table that stores hash of password as binary.
How can I set test data in xml dataset, for example here is hex of my data and I get an error data ...
6
votes
2answers
2k views
Mock MySQL DB for PHPUnit
I'm trying to build unit tests for my Yii project.
Problem: MySQL database. I don't want to have to run a MySQL database every time I run the tests as it is slow, unreliable, maybe some team members ...
3
votes
1answer
734 views
PHPUnit Database Testing. Fixtures not set?
this post was updated on 17 July 1:35PM UTC+8
I have something like
require_once 'PHPUnit/Extensions/Database/TestCase.php';
class TestTest extends PHPUnit_Extensions_Database_TestCase {
public ...
0
votes
1answer
378 views
Mysql SAVEPOINT in PHPUnit Tests
I'm having a problem when running my PHPUnit test of creating a new profile, my code doesnt allow duplicate of profile_name and so i have to change it manually everytime i run a test. I actually ...
13
votes
1answer
312 views
How to test across multiple mysql schemas with PHPUnit?
I would like to test a process that queries across multiple schemas using PHPUnit's PHPUnit_Extensions_Database_TestCase class. I've dug through the documentation, SO and the source code, but it ...
1
vote
2answers
787 views
PHP MySQL Function Unit Testing
I need to test a number of functions that I have created using PHP 5 which carry out the required database CRUD type actions (SELECT, UPDATE, INSERT, DELETE) which are required by my web application.
...
8
votes
2answers
1k views
PHPUnit - test the validity of an SQL Query
I'm in the process of testing a factory class.
One of the methods must load the data in an array for an object that another method will instantiate.
That method contains the SQL query that holds a ...
19
votes
2answers
5k views
Best practices for database testing with PHPUnit
PHPUnit's own manual has some as-yet-unwritten sections entitled "Operations" and "Database Testing Best Practices."
What are best practices for testing a database with PHPUnit, particularly in ...
2
votes
1answer
700 views
How can I use PHPUnit to set up and tear down the database using a SQL file?
I have a MySQL file that represents my database in a specific state that would allow me to test a class I am working on. What I want to do is have PHPUnit clean and rebuild the database from this file ...
0
votes
1answer
97 views
A strange bug, is Mysql asynchronous?
I have a strange bug. I launch a PHP Unit test Suite. At the beginning, it executes a big query to initialize the database.
If I put a breakpoint just after the execution of the sql, there is no ...
0
votes
2answers
503 views
Is there a way to LOG RC Selenium test errors/failures into a database?
Im using phpunit & phpundercontrol to run the RC Selenium on every build.