Scalr\Tests\Service\Aws\RdsTest::removeDBInstance PHP Method

removeDBInstance() protected method

Remove test instance
protected removeDBInstance ( DBInstanceData $dbi )
$dbi Scalr\Service\Aws\Rds\DataType\DBInstanceData
    protected function removeDBInstance(DBInstanceData $dbi)
    {
        $this->assertInstanceOf($this->getRdsClassName('DataType\\DBInstanceData'), $dbi);
        if ($dbi->dBInstanceStatus != DBInstanceData::STATUS_DELETING) {
            $dbi = $dbi->delete(true);
        }
        $timeout = 0;
        while ($dbi->dBInstanceStatus == DBInstanceData::STATUS_DELETING && ($timeout += static::SLEEP_TIMEOUT) < static::SLEEP_TIME) {
            sleep(static::SLEEP_TIMEOUT);
            try {
                $dbi = $dbi->refresh();
            } catch (ClientException $e) {
                if ($e->getErrorData()->getCode() == ErrorData::ERR_DB_INSTANCE_NOT_FOUND) {
                    break;
                }
                throw $e;
            }
        }
    }