T
T
Test Test2015-04-21 11:56:45
Yii
Test Test, 2015-04-21 11:56:45

Why doesn't Codeception work on Yii1?

Hello. Installed and configured Codeception on Yii ( codeception.com/docs/modules/Yii1 ).
1. Wrote the first test

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

2. I'm trying to run the command
~protected>D:\OpenServer\modules\php\PHP-5.6\php.exe codecept.phar run

3. I get this result
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.

I draw your attention to this line:
CHttpException: Unable to resolve the request "site".

My 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

My 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,
);

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

    'components' => array(
        'request' => array(
            'class' => 'CodeceptionHttpRequest',
        ),
    )
);

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dialog, 2015-04-21
@Dialog

What about urlRoutes? Apparently, you just didn't load them :)
offtopic
, but is there any point in developing now on the first version of the framework?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question