Skip to content

t-cyrill/sucre-assertion

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sucre/Assertion

Sucre/Assertion is simple loosely-coupled assertion PHP library.

Requirement


  • PHP 5.4 or later

Installation


Download the composer.phar.

$ curl -s http://getcomposer.org/installer | php

Run Composer: php composer.phar require "cyrill/sucre-assertion"

Usage


<?php
reqire __DIR__.'/composer/autoload.php';

use Sucre\Assertion;

// Assertion::disable(); // if you disable Sucre\Assertion (ie. production)
try {
    Assertion::factory()
        ->mustString($string)
        ->mustNull(null)
        ->assert();
} catch (Exception $e) {
    // If passed values is not fulfilled. "assert" methods throw Sucre\Assertion\CompositeAssertionException
    // $e->getFirstException();
    // $e->getLastException();
    // $e->getExceptions();
    echo $e;
}

How to test?


Sucre\Assertion is tested by PHPUnit.

Run composer composer install --dev. All you have to do is to run phpunit.

License


The MIT License

About

Sucre/Assertion is simple loosely-coupled assertion PHP library.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages