Please add a Zend Framework problem
I'm using PHPUnit to test the model in the Zend project,
The model is like this:
PHP Code
Class Application_model_admingroupmapper { //TODO Impreve inserts here (more portable between another DB engines)
static function Assignmemberstogroup ( Application_model_admingroup & $group, array & $member _ids) { $inserts = Array (); foreach ($member _ids as $id) { $inserts [] = ' ('. $group->id. ', '. mysql_real_escape_string ($id). ') '; } $db = Zend_registry::get (' db '); $res = $db->query ( ' INSERT IGNORE into Admin_group_has_member (admin_group_id, member_id) VALUES '. Implode (', ', $inserts)); return $res->rowcount (); }
The phpunit I wrote was this:
PHP Code
Class Application_model_admingroupmapper { //TODO Impreve inserts here (more portable between another DB engines)
static function Assignmemberstogroup ( Application_model_admingroup & $group, array & $member _ids) { $inserts = Array (); foreach ($member _ids as $id) { $inserts [] = ' ('. $group->id. ', '. mysql_real_escape_string ($id). ') '; } $db = Zend_registry::get (' db '); $res = $db->query ( ' INSERT IGNORE into Admin_group_has_member (admin_group_id, member_id) VALUES '. Implode (', ', $inserts)); return $res->rowcount (); }
But when I run it, I run it in NetBeans, always prompting for no tests, why?
------Solution--------------------
Isn't the two-piece code you put on the same?