forked from yiisoft/yii2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improved intl tests to tolerate ICU data differences
- Added new assertion. - Adjusted tests not to rely on intl version allowing multiple valid variants for Russian and Ukrainian currencies and transliteration.
- Loading branch information
Showing
6 changed files
with
102 additions
and
66 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
namespace yiiunit; | ||
|
||
/** | ||
* IsOneOfAssert asserts that the value is one of the expected values. | ||
*/ | ||
class IsOneOfAssert extends \PHPUnit_Framework_Constraint | ||
{ | ||
private $allowedValues; | ||
|
||
/** | ||
* IsOneOfAssert constructor. | ||
* @param array $allowedValues | ||
*/ | ||
public function __construct(array $allowedValues) | ||
{ | ||
parent::__construct(); | ||
$this->allowedValues = $allowedValues; | ||
} | ||
|
||
|
||
/** | ||
* Returns a string representation of the object. | ||
* | ||
* @return string | ||
*/ | ||
public function toString() | ||
{ | ||
$expectedAsString = "'" . implode("', '", $this->allowedValues) . "'"; | ||
return "is one of $expectedAsString"; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
protected function matches($other) | ||
{ | ||
return in_array($other, $this->allowedValues, false); | ||
} | ||
} |
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,8 @@ | ||
<?php | ||
/* | ||
* Ensures compatibility with PHPUnit 6.x | ||
*/ | ||
|
||
if (!class_exists('PHPUnit_Framework_Constraint') && class_exists('PHPUnit\Framework\Constraint\Constraint')) { | ||
class PHPUnit_Framework_Constraint extends \PHPUnit\Framework\Constraint\Constraint {} | ||
} |
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