protected function AppWarningsCheckerTest::setUp in Apigee Edge 8
Throws
\Exception
Overrides KernelTestBase::setUp
File
- tests/
src/ Kernel/ Entity/ AppWarningsCheckerTest.php, line 131
Class
- AppWarningsCheckerTest
- Tests the AppWarningsChecker.
Namespace
Drupal\Tests\apigee_edge\Kernel\EntityCode
protected function setUp() {
parent::setUp();
$this
->installEntitySchema('user');
$this
->installSchema('system', [
'sequences',
]);
$this
->installConfig([
'apigee_edge',
]);
$this
->apigeeTestHelperSetup();
$this
->addOrganizationMatchedResponse();
$this->account = User::create([
'mail' => $this
->randomMachineName() . '@example.com',
'name' => $this
->randomMachineName(),
'first_name' => $this
->getRandomGenerator()
->word(16),
'last_name' => $this
->getRandomGenerator()
->word(16),
]);
$this->account
->save();
$this
->queueDeveloperResponse($this->account);
$this->developer = Developer::load($this->account
->getEmail());
// Approved App.
$this->approvedAppWithApprovedCredential = DeveloperApp::create([
'name' => 'Approved App with approved credential',
'status' => App::STATUS_APPROVED,
'developerId' => $this->developer
->getDeveloperId(),
]);
$this->approvedAppWithApprovedCredential
->setOwner($this->account);
$this
->queueDeveloperAppResponse($this->approvedAppWithApprovedCredential);
$this->approvedAppWithApprovedCredential
->save();
// Approved app with one revoked credential.
$this->approvedAppWithOneRevokedCredential = DeveloperApp::create([
'name' => $this
->randomMachineName(),
'status' => App::STATUS_APPROVED,
'developerId' => $this->developer
->getDeveloperId(),
]);
$this->approvedAppWithOneRevokedCredential
->setOwner($this->account);
$this
->queueDeveloperAppResponse($this->approvedAppWithOneRevokedCredential);
$this->approvedAppWithOneRevokedCredential
->save();
// Approved app with all credentials revoked.
$this->approvedAppWithAllRevokedCredential = DeveloperApp::create([
'name' => $this
->randomMachineName(),
'status' => App::STATUS_APPROVED,
'developerId' => $this->developer
->getDeveloperId(),
]);
$this->approvedAppWithAllRevokedCredential
->setOwner($this->account);
$this
->queueDeveloperAppResponse($this->approvedAppWithAllRevokedCredential);
$this->approvedAppWithAllRevokedCredential
->save();
// Revoked app with revoked credential.
$this->revokedAppWithRevokedCredential = DeveloperApp::create([
'name' => $this
->randomMachineName(),
'status' => App::STATUS_REVOKED,
'developerId' => $this->developer
->getDeveloperId(),
]);
$this->revokedAppWithRevokedCredential
->setOwner($this->account);
$this
->queueDeveloperAppResponse($this->revokedAppWithRevokedCredential);
$this->revokedAppWithRevokedCredential
->save();
// Approved app with expired credential.
$this->approvedAppWithExpiredCredential = DeveloperApp::create([
'name' => $this
->randomMachineName(),
'status' => App::STATUS_APPROVED,
'developerId' => $this->developer
->getDeveloperId(),
]);
$this->approvedAppWithExpiredCredential
->setOwner($this->account);
$this
->queueDeveloperAppResponse($this->approvedAppWithExpiredCredential);
$this->approvedAppWithExpiredCredential
->save();
// Revoked app with expired credential.
$this->revokedAppWithExpiredCredential = DeveloperApp::create([
'name' => $this
->randomMachineName(),
'status' => App::STATUS_REVOKED,
'developerId' => $this->developer
->getDeveloperId(),
]);
$this->revokedAppWithExpiredCredential
->setOwner($this->account);
$this
->queueDeveloperAppResponse($this->revokedAppWithExpiredCredential);
$this->revokedAppWithExpiredCredential
->save();
}