PHP code example of grithin / phpunit

1. Go to this page and download the library: Download grithin/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/ */

    

grithin / phpunit example snippets


$closure = function(){
	throw new \Exception;
};
$this->assert_exception($closure); # pass with 1 assertion
$this->assert_no_exception($closure); # fail

class Test extends TestCase{
	use Grithin\Phpunit\TestTrait;
	$this->assert_equal_standard($expect, $input, 'merge_deep', 'test straigt list merge');
	function __construct(){
		parent::__construct();

		$this->class = \Grithin\Arrays::class; # set this to use `assert_method_result`
	}
	function test(){
		$x = ['bill'=>['moe'=>'bob']]
		$this->assert_method_result('bob', 'bill.moe', 'get', 'Array::get failed');
	}