havietduc91 / codeception

0 stars 0 forks source link

Lỗi hay gặp #2

Open havietduc91 opened 8 years ago

havietduc91 commented 8 years ago
havietduc91 commented 8 years ago
[RuntimeException] Call to undefined method FunctionalTester::amOnPage

Do define dùng FunctionalTester $I nhưng ở trong file functional.suite.yml chưa include PhpBrowser vào? http://codeception.com/docs/modules/PhpBrowser#.VwSCrfl97IU class_name: FunctionalTester modules: enabled:

add framework module here

    - PhpBrowser:
        url: http://localhost:8888
    - \Helper\Functional
havietduc91 commented 8 years ago
Chưa kết nối được với DB để test, đặc biệt là hàm loginAsAdmin
havietduc91 commented 8 years ago
[Error] Class 'Yii' not found
havietduc91 commented 8 years ago
Tại sao lại có 2 nơi (tests và tests/codeception) để lưu trữ các file sau
havietduc91 commented 8 years ago
Lỗi chưa khai báo class Yii2

Thêm dòng sau vào trong tests/_bootstrap.php

// This is global bootstrap for autoloading

require(__DIR__ . '/../vendor/autoload.php');
require(__DIR__ . '/../vendor/yiisoft/yii2/Yii.php');

$config = require(__DIR__ . '/../config/console.php');
//
$application = new yii\console\Application( $config );
havietduc91 commented 8 years ago
Hiện tại ở phần test đang lấy DB từ đây? needseeker_marketing_tests?? DB này mình có phải import vào không?
class_name: UnitTester
modules:
    enabled:
        - Asserts
        - \Helper\Unit
        - Yii2
        - Db
    config:
        Yii2:
            cleanup: true
            configFile: 'tests/codeception/config/unit.php'
        Db:
            dsn: 'mysql:host=localhost;dbname=needseeker_marketing_platform'
            user: 'root'
            password: ''
            dump: 'tests/codeception/_data/dump.sql'
            cleanup: true

Sau khi thêm phần đó chạy lại vendor/bin/codecept build