Php Yii资产文本当前不工作

Php Yii资产文本当前不工作,php,selenium,yii,phpunit,Php,Selenium,Yii,Phpunit,这是我的环境yii1.1.10,phpunit3.6.0,Selenium服务器2.20.0,php5.2.17 每次我使用命令$this->assertTextPresent('Foo')在我的Yii应用程序上。PHPUnit似乎没有回应,也没有给出反馈。如果我删除了这个断言,PHPunit就起作用了 为什么 没有响应的示例 我尝试用SiteTest.php测试phpunit(Yii中的默认测试示例) 下面是SIteTest.php的内容 <?php class SiteTest e

这是我的环境
yii1.1.10
phpunit3.6.0
Selenium服务器2.20.0
php5.2.17

每次我使用命令
$this->assertTextPresent('Foo')在我的Yii应用程序上。PHPUnit似乎没有回应,也没有给出反馈。如果我删除了这个断言,PHPunit就起作用了

为什么


没有响应的示例

我尝试用SiteTest.php测试phpunit(Yii中的默认测试示例)

下面是SIteTest.php的内容

<?php

class SiteTest extends WebTestCase
{
public function testIndex()
{
    $this->open('');
    $this->assertTextPresent('Welcome');
}

public function testContact()
{
    $this->open('?r=site/contact');
    $this->assertTextPresent('Contact Us');
    $this->assertElementPresent('name=ContactForm[name]');

    $this->type('name=ContactForm[name]','tester');
    $this->type('name=ContactForm[email]','tester@example.com');
    $this->type('name=ContactForm[subject]','test subject');
    $this->click("//input[@value='Submit']");
    $this->waitForTextPresent('Body cannot be blank.');
}

public function testLoginLogout()
{
    $this->open('');
    // ensure the user is logged out
    if($this->isTextPresent('Logout'))
        $this->clickAndWait('link=Logout (demo)');

    // test login process, including validation
    $this->clickAndWait('link=Login');
    $this->assertElementPresent('name=LoginForm[username]');
    $this->type('name=LoginForm[username]','demo');
    $this->click("//input[@value='Login']");
    $this->waitForTextPresent('Password cannot be blank.');
    $this->type('name=LoginForm[password]','demo');
    $this->clickAndWait("//input[@value='Login']");
    $this->assertTextNotPresent('Password cannot be blank.');
    $this->assertTextPresent('Logout');

    // test logout process
    $this->assertTextNotPresent('Login');
    $this->clickAndWait('link=Logout (demo)');
    $this->assertTextPresent('Login');
}
}

这里是结果


其他地方可能有语法错误,请尝试添加

ini_set('error_reporting', E_ALL); // or error_reporting(E_ALL);
ini_set('display_errors', '1');
ini_set('display_startup_errors', '1');

在bootstrap.php的末尾,您能否详细说明“PHPUnit似乎没有响应”的含义?@DavidHarkness我编辑了我的问题,添加了PHPUnit没有响应的示例:PHPUnit在显示PHPUnit版本之前,对每个测试方法和
@dataProvider
实例化每个测试用例一次。如果这些模块或类中的任何一个调用退出或导致错误,PHPUnit将在没有任何输出的情况下死亡。在
php.ini
中打开所有错误报告,并将
error\u log
设置为可写入的文件。在运行测试之前,这应该会给您一些关于它失败原因的线索。顺便说一句,您的最后一个示例非常清楚:PHPUnit将在没有任何测试方法或断言的情况下失败任何测试。
ini_set('error_reporting', E_ALL); // or error_reporting(E_ALL);
ini_set('display_errors', '1');
ini_set('display_startup_errors', '1');