Hi!

Am 04.09.2011 16:21, schrieb Tjerk Anne Meesters:
datibbaw                                 Sun, 04 Sep 2011 14:21:27 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=316108

Log:
Patch to run two more mysql test cases that would usually be skipped.

Replaced skipifdefaultconnectionfailure.inc by three additional ini_set() 
statements in connect.inc for the default connection settings

Patch also includes a typo in connect.inc concerning mysql.default_socket

Please, revert! Two things get mixed together, accidently changing code flow, good and valid goal, but different implementation, please...

a) Please, do no change connect.inc to allow tests to fool themselves. If testing default connections, do this on a per-test basis

Default connections are evil and hard to debug. Generally speaking I do not want any test to be accidently fooled by a default connection, thus do not set defaults in connect.inc . At a quick look, I cannot tell why socket has been set in connect.inc.

b) Code flow change

Some functions, such as mysql_affected_rows(), attempt to open a default connection. The test starts with:

 if (0 !== ($tmp = @mysql_affected_rows()))

The first assertion made covers:

 mysql_affected_rows()
   -> no connection given
   -> attempt to open default connection

Before your change the test checked what happens if no default connection can be opened:

 mysql_affected_rows()
   -> no connection given
   -> attempt to open default connection
   -> open fails
   <- return

After your change the test checks what happens if a default connection can be opened:

 mysql_affected_rows()
   -> no connection given
   -> attempt to open default connection
   -> open success
   <- return

As you can see, you have changed the semantics of the test. Probably accidently, you have added an assertion not tested before but at the same time removed an assertion. Before your change three assertions have been checked:

(1) mysql_affected_rows()
   -> no connection given
   -> attempt to open default connection
   -> open fails
   <- return

(2) mysql_affected_rows()
   -> valid connection given
   <- return

(3) mysql_affected_rows()
   -> invalid connection given
   <- return

Due to your change (1) has been replaced with:

(4) mysql_affected_rows()
   -> no connection given
   -> attempt to open default connection
   -> open succeeds
   <- return

Now, if you did your changes in a way that 1-4 are covered, that would be wonderful. I'm actually a bit suprised of the result that one gets for (4). That will make a great new test. Thanks for the idea!

However, please, revert this commit and "do it right".

Ulf

--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to