Created
November 13, 2015 12:18
-
-
Save Naktibalda/1bf96a2a22b32ebd08c7 to your computer and use it in GitHub Desktop.
assertMatchesTypes method
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
<?php | |
namespace Helper; | |
use Codeception\Util\JsonType; | |
class Unit extends \Codeception\Module | |
{ | |
public function assertMatchesTypes(array $types, array $data, $message = null) | |
{ | |
$jsonType = new JsonType($data); | |
$result = $jsonType->matches($types); | |
if ($result !== TRUE) { | |
if (!$message) { | |
$message = $result; | |
} | |
$this->fail($message); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment