for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace app\tests\api;
// @codingStandardsIgnoreLine
use ApiTester;
use app\core\exceptions\ErrorCodes;
use Codeception\Util\HttpCode;
class LoginUserCest
{
/**
* @codingStandardsIgnoreStart
* @param ApiTester $I
*/
public function _before(ApiTester $I)
$I
If this is a false-positive, you can also ignore this issue in your code via the ignore-unused annotation
ignore-unused
public function _before(/** @scrutinizer ignore-unused */ ApiTester $I)
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
// @codingStandardsIgnoreEnd
}
public function userLoginFail(ApiTester $I)
$I->haveHttpHeader('content-type', 'application/json');
$I->sendPOST('/login', [
'username' => 'demo',
'password' => 'pass123456',
]);
$I->seeResponseCodeIs(HttpCode::OK); // 200
$I->seeResponseIsJson();
$I->seeResponseContainsJson(['code' => ErrorCodes::INVALID_ARGUMENT_ERROR]);
* @param CreateUserCest $createUserCest
public function userLogin(ApiTester $I, CreateUserCest $createUserCest)
$createUserCest->createUser($I);
'password' => 'pass123',
$I->seeResponseContainsJson(['code' => 0]);
$I->seeResponseJsonMatchesXpath('//data/token');
$I->seeResponseJsonMatchesXpath('//data/user/username');
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.