4

Silexと同様にphpunit3.6.12をインストールしています。私のアプリのルートディレクトリには、簡単なテストファイルBlogFunctionTest.phpを含むテストディレクトリがあります。

<?

use Silex\WebTestCase;

// BLOG: Front end test
class BlogFunctionalTest extends Silex\WebTestCase
{
    public function testIndex()
    {
        $this->assertGreaterThan(0, 1);
    }
}

?>

コマンドラインからphpunitを実行すると、エラーが発生します

PHP Fatal error:  Class 'Silex\WebTestCase' not found in {path}/BlogFunctionTest.php line 7

これは、WebTestCaseを拡張しようとしている行を指します。交換しても同じことが起こります

use Silex\WebTestCase;

use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;

Silexは、私のテストファイルに関連してインストールされています。

../vendor/silex/

ヒントは大歓迎です、ありがとう!

4

1 に答える 1

7

https://github.com/joshuamorse/Silex-Boilerplate/blob/master/phpunit.xml.distで行われているように、silexアプリケーションのブートストラップを指すphpunit.xml.dist内にブートストラップを定義する必要があります。

于 2012-09-26T02:53:26.650 に答える