@cubooks
Web-developer

Почему не работает Codeception на Yii1?

Всем привет. Установил и настроил Codeception на Yii (codeception.com/docs/modules/Yii1).

1. Написал первый тест

<?php
$I = new AcceptanceTester($scenario);
$I->wantTo('create wiki page');
$I->amOnPage('/');
?>


2. Пытаюсь запустить командой
~protected>D:\OpenServer\modules\php\PHP-5.6\php.exe codecept.phar run


3. Получаю вот такой результат
Time: 163 ms, Memory: 8.00Mb

There was 1 error:

---------
1) Failed to create wiki page in WelcomeCept (D:\OpenServer\domains\site\app\protected\tests\functional\WelcomeCept.php)
Can't be on page "/":
CHttpException: Unable to resolve the request "site".

Scenario Steps:
1. I am on page "/"

#1  D:\OpenServer\domains\site\framework\web\CWebApplication.php:141
#2  D:\OpenServer\domains\site\framework\base\CApplication.php:180
#3  Codeception\Lib\InnerBrowser->amOnPage
#4  D:\OpenServer\domains\site\app\protected\tests\acceptance\AcceptanceTester.php:112
#5  D:\OpenServer\domains\site\app\protected\tests\functional\WelcomeCept.php:4
#6  Codeception\TestCase\Cept->testCodecept
#7  D:\OpenServer\domains\site\app\protected\codecept.phar:7

FAILURES!
Tests: 1, Assertions: 0, Errors: 1.


Обращаю внимание вот на этому строку:
CHttpException: Unable to resolve the request "site".


Мой codeception.yml:
actor: Tester
paths:
    tests: tests
    log: tests/_output
    data: tests/_data
    helpers: tests/_support
settings:
    bootstrap: _bootstrap.php
    colors: false
    memory_limit: 1024M
modules:
    enabled: [PhpBrowser, WebHelper, TestHelper, Yii1]
    config:
        Db:
            dsn: ''
            user: ''
            password: ''
            dump: tests/_data/dump.sql
        PhpBrowser:
            url: http://site
        Yii1:
            appPath: ../test.php
            url: http://site/test.php


Мой test.php
<?php
// change the following paths if necessary
$yii=dirname(__FILE__).'/../framework/yii.php';
$config=dirname(__FILE__).'/protected/config/test.php';

// remove the following lines when in production mode
defined('YII_DEBUG') or define('YII_DEBUG',true);
// specify how many levels of call stack should be shown in each log message
defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);
require_once($yii);


return array(
    'class' => 'CWebApplication',
    'config' => $config,
);


Мой protected/config/test.php
<?php return array(
    'basePath' => dirname(__FILE__) . DIRECTORY_SEPARATOR . '..',

    'components' => array(
        'request' => array(
            'class' => 'CodeceptionHttpRequest',
        ),
    )
);
  • Вопрос задан
  • 1058 просмотров
Пригласить эксперта
Ответы на вопрос 1
@Dialog
А что у вас с urlRoutes? Судя по всему, вы их просто не подгрузили :)

оффтоп
а есть ли смысл сейчас разрабатывать на первой версии фреймворка?
Ответ написан
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы