PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
It is currently Mon Jan 22, 2018 11:34 am

All times are UTC - 5 hours

Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Mon Apr 02, 2012 12:24 pm 
Forum Commoner

Joined: Mon Sep 27, 2010 3:26 pm
Posts: 73

I am working on testing a project, using database input. My application takes as input , individual records ( table rows ) from a mysql table. As I've tested, I have gradually debugged the program so that almost all the records result in correct output, but there are still a few that are causing problems. I would to select ONLY the individual records, that are still causing problems for input, or else suspend the program when one of the records of concern is being taken as input. I'd like to do this if possible without hard coding

Is there a way to set a watch in XDEBUG so that the program is run until a certain record is reached , when it can break, allowing me to step through the code.

Another way I've thought of doing this is somehow to sort the mysql table ( in phpmyadmin? ) so that the problem records would be taken as the first input,

Are either of these possible, or is there a better way?

Thanks in advance,


PostPosted: Sat Jan 20, 2018 7:34 am 
User avatar

Joined: Tue Nov 09, 2010 3:39 pm
Posts: 6408
Location: Montreal, Canada
I advise against using data from a database to populate your tests as a change in any of these rows can cause tests to begin failing for no discernible reason. Sure, it might be more work to transform these into datasets for DBUnit or into data providers for PHPUnit, but you will also end up with higher confidence in your tests.

Supported PHP versions No longer supported versions

PostPosted: Sat Jan 20, 2018 4:23 pm 
Site Administrator
User avatar

Joined: Wed Aug 25, 2004 7:54 pm
Posts: 13476
Location: New York, NY, US
Yes, if you are getting data from a database to test, you should be able to mock that data and run the tests reliably and in any order you want. Celauran's suggestion of datasets or data providers is a good direction.


Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 5 hours

Who is online

Users browsing this forum: No registered users and 3 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group