Skip to content

Instantly share code, notes, and snippets.

@Naktibalda
Created November 13, 2015 12:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Naktibalda/1bf96a2a22b32ebd08c7 to your computer and use it in GitHub Desktop.
Save Naktibalda/1bf96a2a22b32ebd08c7 to your computer and use it in GitHub Desktop.
assertMatchesTypes method
<?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