2016-06-22 4 views
0

私は私の機能テストを実行しようとしています、これは私が機能テスト、[PHPUnitのFramework_Exception]:未定義のインデックス:コンフィグ

[PHPUnit_Framework_Exception]未定義のインデックスを取得エラーメッセージです:Cでの設定:\ WAMP \ WWW \を私は、機能/ _bootstrap.phpファイルにURLを解析しようとしているライン4 **

上functional_bootstrap.php \ test.qsims.com \テスト。私は私の$ ./vendor/bin/codecept実行を実行すると、次のコードは、

<?php 
    define('DS', DIRECTORY_SEPARATOR); 

    defined('YII_TEST_ENTRY_URL') or define('YII_TEST_ENTRY_URL', parse_url(\Codeception\Configuration::config()['config']['test_entry_url'], PHP_URL_PATH)); 
    defined('YII_TEST_ENTRY_FILE') or define('YII_TEST_ENTRY_FILE', dirname(dirname(__DIR__)) . '/web/index-test.php'); 

    // Define our application_env variable as provided by nginx/apache 
    if (!defined('APPLICATION_ENV')) 
    { 
     if (getenv('APPLICATION_ENV') != false) 
      define('APPLICATION_ENV', getenv('APPLICATION_ENV')); 
     else 
     define('APPLICATION_ENV', 'dev'); 
    } 
    $env = require(__DIR__ . '/../../config/env.php'); 
    // comment out the following two lines when deployed to production 
    defined('YII_DEBUG') or define('YII_DEBUG', $env['debug']); 
    defined('YII_ENV') or define('YII_ENV', APPLICATION_ENV); 
    require(__DIR__ . '/../../vendor/autoload.php'); 
    require(__DIR__ . '/../../vendor/yiisoft/yii2/Yii.php'); 
    $config = require(__DIR__ . '/../../config/web.php'); 

    $_SERVER['SCRIPT_FILENAME'] = YII_TEST_ENTRY_FILE; 
    $_SERVER['SCRIPT_NAME'] = YII_TEST_ENTRY_URL; 
    $_SERVER['SERVER_NAME'] = parse_url(\Codeception\Configuration::config()['config']['test_entry_url'], PHP_URL_HOST); 
    $_SERVER['SERVER_PORT'] = parse_url(\Codeception\Configuration::config()['config']['test_entry_url'], PHP_URL_PORT) ?: '80'; 

    Yii::setAlias('@tests', dirname(__DIR__)); 

    (new yii\web\Application($config)); 

を下回っています。私は上記のエラーを取得します。

だから、すなわち第四行でもparse_urlラインは、コードを壊しています。誰もが過去6時間かそこらからそれを解決しようとすると、この中で私を助けることができます。..事前に感謝

Codeception.yml

actor: Tester 
#coverage: 
# #c3_url: http://localhost:8080/index-test.php/ 
# enabled: true 
# #remote: true 
# #remote_config: '../tests/codeception.yml' 
# white_list: 
#  include: 
#   - ../models/* 
#   - ../controllers/* 
#   - ../commands/* 
#   - ../mail/* 
# blacklist: 
#  include: 
#   - ../assets/* 
#   - ../config/* 
#   - ../runtime/* 
#   - ../vendor/* 
#   - ../views/* 
#   - ../web/* 
#   - ../tests/* 
paths: 
    tests: codeception 
    log: codeception/_output 
    data: codeception/_data 
    helpers: codeception/_support 
settings: 
    bootstrap: _bootstrap.php 
    suite_class: \PHPUnit_Framework_TestSuite 
    memory_limit: 1024M 
    log: true 
    colors: true 
config: 
    # the entry script URL (with host info) for functional and acceptance tests 
    # PLEASE ADJUST IT TO THE ACTUAL ENTRY SCRIPT URL 
    test_entry_url: http://localhost:8080/index-test.php 

functional.suite.yml

class_name: FunctionalTester 
modules: 
    enabled: 
     - Filesystem 
     - Yii2 
    config: 
     Yii2: 
      configFile: 'codeception/config/functional.php' 
+0

あなたの質問にあなたのcodeception.ymlファイルを追加してください、おそらく設定セクションがありません。私はcodeception.ymlファイル@Naktibalda – Naktibalda

+0

はそれがCodeception.ymlまたはcodeception.ymlのですか?それは申し訳ありませんが、私の悪いcodeception.ymlある –

+0

を追加した – Naktibalda

答えて

0
defined('YII_TEST_ENTRY_URL') or define('YII_TEST_ENTRY_URL', parse_url(\Codeception\Configuration::config()['config']['test_entry_url'], PHP_URL_PATH)); 

上記のコードを次のコードに変更してください。

私は実際のURLへ parse_url(\Codeception\Configuration::config()['config']['test_entry_url'], PHP_URL_PATH))の代わりにURLをhardcordedしているので、それは私のURL形式のcodeception.ymlフォームを取得していなかったいくつかの理由
defined('YII_TEST_ENTRY_URL') or define('YII_TEST_ENTRY_URL', 'http://test.qsims.com/web/index-test.php'); 

'http://test.qsims.com/web/index-test.php'