You are here

protected function DeveloperTest::tearDown in Apigee Edge 8

Overrides BrowserTestBase::tearDown

File

tests/src/Functional/DeveloperTest.php, line 109

Class

DeveloperTest
Create, delete, update developer entity tests.

Namespace

Drupal\Tests\apigee_edge\Functional

Code

protected function tearDown() {
  $this->stack
    ->reset();
  try {
    if ($this->developer !== NULL) {
      $this
        ->queueDeveloperResponseFromDeveloper($this->developer);
      $this->developer
        ->delete();
    }
  } catch (\Exception $exception) {
    $this
      ->logException($exception);
  }
  try {
    if ($this->company !== NULL) {
      $this->stack
        ->queueMockResponse([
        'company' => [
          'company' => $this->company,
        ],
      ]);
      $company_controller = new CompanyController($this->sdkConnector
        ->getOrganization(), $this->sdkConnector
        ->getClient());
      $company_controller
        ->delete($this->company
        ->id());
    }
  } catch (\Exception $exception) {
    $this
      ->logException($exception);
  }
  try {
    if ($this->developerRegistered !== NULL) {
      $this
        ->queueDeveloperResponseFromDeveloper($this->developerRegistered);
      $this->developerRegistered
        ->delete();
    }
  } catch (\Exception $exception) {
    $this
      ->logException($exception);
  }
  try {
    if ($this->developerCreatedByAdmin !== NULL) {
      $this
        ->queueDeveloperResponseFromDeveloper($this->developerCreatedByAdmin);
      $this->developerCreatedByAdmin
        ->delete();
    }
  } catch (\Exception $exception) {
    $this
      ->logException($exception);
  }
  parent::tearDown();
}