/** * @param string the class to create a class mock of * @param callable|null|void The build phase closure * @return string the name of the mock class */ public function shmock_class($clazz, $closure = null) { if (!$closure) { $closure = function () { }; } return Shmock::create_class($this, $clazz, $closure); }
public function test_arg_policy_does_not_throw_when_no_args_passed_and_escape_flag_set() { Shmock::$check_args_for_policy_on_instance_method_when_no_args_passed = false; $calc = $this->shmock('Shmock\\Even_Calculator', function ($calculator) { $calculator->raise_to_even()->return_value(6); }); Shmock::$check_args_for_policy_on_instance_method_when_no_args_passed = true; $this->assertEquals($calc->raise_to_even(13), 6); }
public function tearDown() { Shmock::verify(); }