This repository has been archived by the owner on Aug 17, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
27f7feb
commit e9a7f37
Showing
3 changed files
with
77 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<?php | ||
|
||
namespace Tests\Resiliency\Exceptions; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use Resiliency\Exceptions\InvalidSystem; | ||
|
||
class InvalidSystemTest extends TestCase | ||
{ | ||
public function testCreation() | ||
{ | ||
$invalidPlace = new InvalidSystem(); | ||
|
||
$this->assertInstanceOf(InvalidSystem::class, $invalidPlace); | ||
} | ||
|
||
/** | ||
* @dataProvider getSettings | ||
* | ||
* @param array $settings | ||
* @param string $expectedExceptionMessage | ||
*/ | ||
public function testInvalidSettings($settings, $expectedExceptionMessage) | ||
{ | ||
$invalidSystem = InvalidSystem::missingSettings($settings); | ||
|
||
$this->assertSame($invalidSystem->getMessage(), $expectedExceptionMessage); | ||
} | ||
|
||
/** | ||
* @return array | ||
*/ | ||
public function getSettings() | ||
{ | ||
return [ | ||
'all_missing_settings' => [ | ||
[], | ||
'Missing settings for System:' . PHP_EOL . | ||
'The setting "timeout" is missing from configuration' . PHP_EOL . | ||
'The setting "stripped_timeout" is missing from configuration' . PHP_EOL . | ||
'The setting "failures" is missing from configuration' . PHP_EOL . | ||
'The setting "threshold" is missing from configuration' . PHP_EOL, | ||
], | ||
'2_missing_settings' => [ | ||
[ | ||
'failures' => 1, | ||
'timeout' => -1, | ||
], | ||
'Missing settings for System:' . PHP_EOL . | ||
'The setting "stripped_timeout" is missing from configuration' . PHP_EOL . | ||
'The setting "threshold" is missing from configuration' . PHP_EOL, | ||
], | ||
'1_missing_setting' => [ | ||
[ | ||
'failures' => 1, | ||
'timeout' => 1.0, | ||
'stripped_timeout' => -1, | ||
], | ||
'Missing settings for System:' . PHP_EOL . | ||
'The setting "threshold" is missing from configuration' . PHP_EOL, | ||
], | ||
'all_present_settings' => [ | ||
[ | ||
'failures' => 1, | ||
'timeout' => 1.0, | ||
'stripped_timeout' => 1.0, | ||
'threshold' => 1.0, | ||
], | ||
'Missing settings for System:' . PHP_EOL, | ||
], | ||
]; | ||
} | ||
} |