Assert: exception code #102

Closed
wants to merge 1 commit into
from

Projects

None yet

4 participants

@Vrtak-CZ

No description provided.

@fprochazka fprochazka and 1 other commented on an outdated diff Feb 25, 2014
Tester/Framework/Assert.php
@@ -243,6 +244,8 @@ public static function exception($function, $class, $message = NULL)
} elseif ($message && !self::isMatching($message, $e->getMessage())) {
self::fail("$class with a message matching %2 was expected but got %1", $e->getMessage(), $message);
+ } elseif ($code && !self::isMatching($code, $e->getCode())) {
@fprochazka
fprochazka Feb 25, 2014

$code !== NULL, otherwise Assert::exception(..., 0); wouldn't work

@dg dg and 2 others commented on an outdated diff Feb 25, 2014
Tester/Framework/Assert.php
@@ -243,6 +244,8 @@ public static function exception($function, $class, $message = NULL)
} elseif ($message && !self::isMatching($message, $e->getMessage())) {
self::fail("$class with a message matching %2 was expected but got %1", $e->getMessage(), $message);
+ } elseif ($code !== NULL && !self::isMatching($code, $e->getCode())) {
@dg
dg Feb 25, 2014

isMatching? What about !==

@Vrtak-CZ
Vrtak-CZ Feb 25, 2014

I'm just copy previous condition from message comparsion.

@fprochazka
fprochazka Feb 25, 2014

The ability to use a pattern makes sense for string message, but not for an integer.

@milo
Nette Foundation member

Merged 52104ae (I removed word 'matching' from message)

@milo milo closed this Feb 26, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment