Home > Backend Development > PHP Tutorial > 请加一个zend framework的有关问题

请加一个zend framework的有关问题

WBOY
Release: 2016-06-13 13:51:22
Original
933 people have browsed it

请加一个zend framework的问题
我在用phpunit测试zend项目里的model, 
这个model是这样的:

PHP code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->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();
    }
Copy after login
Copy after login


我写的phpunit是这样的:
PHP code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->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();
    }
Copy after login
Copy after login


但是当我运行的时候,我是在Netbeans里运行的,总是提示没有执行任何测试,这是为什么?

------解决方案--------------------
你贴的两段代码难道不是一样的?
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template