使用Yii2和Codeception的$ scenario函数测试错误

I am trying to write functional tests but I am getting the error:

PHPUnit_Framework_Exception: Undefined variable: scenario

My test looks like this:

<?php

use tests\functional;

class AccountTest extends \Codeception\TestCase\Test
{
/**
 * @var \FunctionalTester
 */
protected $tester;

protected $url = 'http://domain.api/v1/api';

// tests
public function testMe()
{
    $I = new FunctionalTester($scenario);
    $I->haveHttpHeader('Content-Type', 'application/json'); //remove
    $I->haveHttpHeader('Accept', 'application/json'); //remove
    $I->sendPost('/account/register');
    $I->seeResponseCodeIs(200);
    $I->seeResponseIsJson();
  }

}

What do I need to add for $scenario to be available?

Give your testMe() method the arguments $I and $scenario:

public function($I, $scenario)
{
    [...]
}

You don't need to instantiate the FunctionalTester() then.