mirror of
				https://github.com/elyby/accounts.git
				synced 2025-05-31 14:11:46 +05:30 
			
		
		
		
	Удалена зависимость от yiisoft/yii2-codeception в пользу интегрированного в Codeception генератора REST адресов
Реорганизованы объекты Pages для Functional тестов Исправлены не переименованные тесты, оставшиеся после последнего рефакторинга
This commit is contained in:
		
							
								
								
									
										47
									
								
								tests/codeception/api/functional/AccountsBanCest.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								tests/codeception/api/functional/AccountsBanCest.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,47 @@
 | 
			
		||||
<?php
 | 
			
		||||
namespace tests\codeception\api\functional;
 | 
			
		||||
 | 
			
		||||
use common\rbac\Permissions as P;
 | 
			
		||||
use tests\codeception\api\_pages\AccountsRoute;
 | 
			
		||||
use tests\codeception\api\functional\_steps\OauthSteps;
 | 
			
		||||
use tests\codeception\api\FunctionalTester;
 | 
			
		||||
 | 
			
		||||
class AccountsBanCest {
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var AccountsRoute
 | 
			
		||||
     */
 | 
			
		||||
    private $route;
 | 
			
		||||
 | 
			
		||||
    public function _before(FunctionalTester $I) {
 | 
			
		||||
        $this->route = new AccountsRoute($I);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function testBanAccount(OauthSteps $I) {
 | 
			
		||||
        $accessToken = $I->getAccessTokenByClientCredentialsGrant([P::BLOCK_ACCOUNT]);
 | 
			
		||||
        $I->amBearerAuthenticated($accessToken);
 | 
			
		||||
 | 
			
		||||
        $this->route->ban(1);
 | 
			
		||||
        $I->canSeeResponseCodeIs(200);
 | 
			
		||||
        $I->canSeeResponseIsJson();
 | 
			
		||||
        $I->canSeeResponseContainsJson([
 | 
			
		||||
            'success' => true,
 | 
			
		||||
        ]);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function testBanBannedAccount(OauthSteps $I) {
 | 
			
		||||
        $accessToken = $I->getAccessTokenByClientCredentialsGrant([P::BLOCK_ACCOUNT]);
 | 
			
		||||
        $I->amBearerAuthenticated($accessToken);
 | 
			
		||||
 | 
			
		||||
        $this->route->ban(10);
 | 
			
		||||
        $I->canSeeResponseCodeIs(200);
 | 
			
		||||
        $I->canSeeResponseIsJson();
 | 
			
		||||
        $I->canSeeResponseContainsJson([
 | 
			
		||||
            'success' => false,
 | 
			
		||||
            'errors' => [
 | 
			
		||||
                'account' => 'error.account_already_banned',
 | 
			
		||||
            ],
 | 
			
		||||
        ]);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user