mirror of
https://github.com/retailcrm/mailgun-php.git
synced 2024-11-22 04:26:02 +03:00
Make integrationt tests safe to run simultaneously (#338)
* Make integrationt tests safe to run simultaneously * cs * We only have the credentials when we do not make a PR
This commit is contained in:
parent
afd8f361f3
commit
fab86bbef3
@ -20,13 +20,15 @@ matrix:
|
|||||||
fast_finish: true
|
fast_finish: true
|
||||||
include:
|
include:
|
||||||
- php: 5.5
|
- php: 5.5
|
||||||
env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" COVERAGE=true
|
env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" PREFER_COVERAGE=true
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- travis_retry composer update ${COMPOSER_FLAGS} --prefer-source --no-interaction
|
- travis_retry composer update ${COMPOSER_FLAGS} --prefer-source --no-interaction
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
- if [[ "COVERAGE" = true ]]; then TEST_COMMAND="composer test-coverage"; fi
|
- if [[ "COVERAGE" = true ]]; then TEST_COMMAND="composer test-coverage"; fi
|
||||||
|
- if ! [[ "$TRAVIS_PULL_REQUEST" = false ]]; then TEST_COMMAND="composer test"; fi
|
||||||
|
- if [[ "$PREFER_COVERAGE" = true ]] && [[ "$TRAVIS_PULL_REQUEST" = false ]]; then TEST_COMMAND="composer test-coverage" COVERAGE=true; fi
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- echo $TEST_COMMAND
|
- echo $TEST_COMMAND
|
||||||
|
@ -26,11 +26,19 @@ use Mailgun\Tests\Api\TestCase;
|
|||||||
*/
|
*/
|
||||||
class DomainApiTest extends TestCase
|
class DomainApiTest extends TestCase
|
||||||
{
|
{
|
||||||
|
private static $domainName;
|
||||||
|
|
||||||
protected function getApiClass()
|
protected function getApiClass()
|
||||||
{
|
{
|
||||||
return 'Mailgun\Api\Domain';
|
return 'Mailgun\Api\Domain';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function setUpBeforeClass()
|
||||||
|
{
|
||||||
|
parent::setUpBeforeClass();
|
||||||
|
self::$domainName = 'example.'.uniqid().'notareal.tld';
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Performs `GET /v3/domains` and ensures $this->testDomain exists
|
* Performs `GET /v3/domains` and ensures $this->testDomain exists
|
||||||
* in the returned list.
|
* in the returned list.
|
||||||
@ -89,7 +97,7 @@ class DomainApiTest extends TestCase
|
|||||||
$mg = $this->getMailgunClient();
|
$mg = $this->getMailgunClient();
|
||||||
|
|
||||||
$domain = $mg->domains()->create(
|
$domain = $mg->domains()->create(
|
||||||
'example.notareal.tld', // domain name
|
self::$domainName, // domain name
|
||||||
'exampleOrgSmtpPassword12', // smtp password
|
'exampleOrgSmtpPassword12', // smtp password
|
||||||
'tag', // default spam action
|
'tag', // default spam action
|
||||||
false // wildcard domain?
|
false // wildcard domain?
|
||||||
@ -112,7 +120,7 @@ class DomainApiTest extends TestCase
|
|||||||
$mg = $this->getMailgunClient();
|
$mg = $this->getMailgunClient();
|
||||||
|
|
||||||
$mg->domains()->create(
|
$mg->domains()->create(
|
||||||
'example.notareal.tld', // domain name
|
self::$domainName, // domain name
|
||||||
'exampleOrgSmtpPassword12', // smtp password
|
'exampleOrgSmtpPassword12', // smtp password
|
||||||
'tag', // default spam action
|
'tag', // default spam action
|
||||||
false // wildcard domain?
|
false // wildcard domain?
|
||||||
@ -126,7 +134,7 @@ class DomainApiTest extends TestCase
|
|||||||
{
|
{
|
||||||
$mg = $this->getMailgunClient();
|
$mg = $this->getMailgunClient();
|
||||||
|
|
||||||
$ret = $mg->domains()->delete('example.notareal.tld');
|
$ret = $mg->domains()->delete(self::$domainName);
|
||||||
$this->assertNotNull($ret);
|
$this->assertNotNull($ret);
|
||||||
$this->assertInstanceOf(DeleteResponse::class, $ret);
|
$this->assertInstanceOf(DeleteResponse::class, $ret);
|
||||||
$this->assertEquals('Domain has been deleted', $ret->getMessage());
|
$this->assertEquals('Domain has been deleted', $ret->getMessage());
|
||||||
|
Loading…
Reference in New Issue
Block a user