PHP code example of rest-certain / hamcrest-phpunit

1. Go to this page and download the library: Download rest-certain/hamcrest-phpunit library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

rest-certain / hamcrest-phpunit example snippets

 php
use PHPUnit\Framework\TestCase;

use function RestCertain\Hamcrest\assertThat;
use function RestCertain\Hamcrest\both;
use function RestCertain\Hamcrest\containsStringIgnoringCase;
use function RestCertain\Hamcrest\isA;
use function RestCertain\Hamcrest\startsWithIgnoringCase;

class ExampleTest extends TestCase
{
    public function testExample(): void
    {
        assertThat(
            'The quick brown fox jumps over the lazy dog',
            both(isA('string'))
                ->and(startsWithIgnoringCase('the'))
                ->and(containsStringIgnoringCase('FOX')),
        );
    }
}