grithin/phpunit

0.1 2021-07-21 12:14 UTC

This package is not auto-updated.

Last update: 2024-06-21 01:03:00 UTC


README

PHPUnit Tools

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

assert_method_result

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');
	}