L
L
Lomoson2016-06-26 12:39:59
Yii
Lomoson, 2016-06-26 12:39:59

API testing codeception+Yii2. How to specify another base for the test?

Can you please tell me how to set up the execution of API tests with a test base?

$I = new ApiTester($scenario);
$I->wantTo('Get something');

$I->sendGET('somethings');
$I->seeResponseIsJson();
$I->seeResponseCodeIs(200);

All the rules, but I just don’t want to touch the main base.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Pantyukhov, 2016-06-27
@Paromon

Of course, I'm a beginner and don't understand much... but isn't it easier to temporarily rewrite the db.php file in api/config/requires?
Well, like pushed aside and returned everything back. I have this in the file

//    'dsn' => 'mysql:host="бла бла.ком";dbname=tor',
//    'username' => 'tor',
//    'password' => '',
//    'charset' => 'utf8',

    'dsn' => 'mysql:host=127.0.0.1;dbname=tor',
    'username' => 'root',
    'password' => '',
    'charset' => 'utf8',

disconnected when necessary, connected when necessary

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question