Skip to content

Instantly share code, notes, and snippets.

@ludo237
Created March 7, 2018 15:11
Show Gist options
  • Save ludo237/3128c0cb3c517a9ec0d94144ba54e976 to your computer and use it in GitHub Desktop.
Save ludo237/3128c0cb3c517a9ec0d94144ba54e976 to your computer and use it in GitHub Desktop.
Laravel PHP custom assertions
<?php
namespace Tests\Utils;
use Ramsey\Uuid\Uuid;
/**
* Trait Assertions
* @package Tests\Utils
*/
trait Assertions
{
/**
* Check if the given uuid is valid according to Ramsey\Uuid package
* @param string $uuid
*/
public function assertUuidIsValid(string $uuid)
{
$message = "The given uuid {$uuid} is not valid";
self::assertThat(Uuid::isValid($uuid), self::isTrue(), $message);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment