0

php-activerecord をテストしようとしていますが、いくつかのテストがあります。実行時:

phpunit sometestname

何も起こらなかった。コードを確認したところ、

include 'helpers/config.php';

require_once dirname(__FILE__) . '/../lib/Inflector.php';

class InflectorTest extends SnakeCase_PHPUnit_Framework_TestCase

{
    public function set_up()
    {
        $this->inflector = ActiveRecord\Inflector::instance();
    }

    public function testOne()
    {
        $this->assertTrue(2+2==4);
    }

何か案が?

ここに画像の説明を入力

4

1 に答える 1

5

PHPUnit のバージョンが少し古くなっています。あなたが最新であることを確認しましょう。してください

pear channel-discover pear.phpunit.de
pear channel-discover components.ez.no
pear channel-discover pear.symfony-project.com

その後

pear install --force --alldeps phpunit/PHPUnit again

これにより、

downloading PHPUnit-3.5.13.tgz ...
Starting to download PHPUnit-3.5.13.tgz (118,553 bytes)
..........................done: 118,553 bytes
install ok: channel://pear.phpunit.de/PHPUnit-3.5.13

エラーがある場合は、PEAR のバージョンを現在のバージョンにアップグレードしてみてください。

pear upgrade-all

PHPActiveRecord のテスト ヘルパーの DocBlock は次のように述べています

/**
* In order to run these unit tests, you need to install:
* - PHPUnit
* - PEAR Log (otherwise logging SQL queries will be disabled)
* - Memcache (otherwise Caching tests will not be executed)
*
* To run all tests : phpunit AllTests.php --slow-tests
* To run a specific test : phpunit ????Test.php
*/

ただし、ログの依存関係のために、2 つの抑制されたインクルードが含まれています。

@include_once 'Log.php';
@include_once 'Log/file.php';

これが、CLI でまったく結果が得られない理由である可能性があります。

pear install --force --alldeps Log

それでうまくいくはずです。

編集: PHPActiveRecord Web サイトから入手できる 1.0 バージョンには、上記の DocBlock がなくrequire_once、Log 依存関係を使用します。これは現在のマスター バージョンで変更されているため、ナイトリーを試すか、GitHub からマスター ブランチをチェックアウトすることをお勧めします。

于 2011-04-03T11:15:16.057 に答える