/** * @covers ::now */ public function testDoesNotExecuteCallbackIfContractsDisabled() { // ---------------------------------------------------------------- // setup your test $executed = false; $callback = function () use(&$executed) { $executed = true; }; ContractChecks::disable(); // ---------------------------------------------------------------- // perform the change CheckContracts::now($callback, []); // ---------------------------------------------------------------- // test the results $this->assertFalse($executed); }
/** * check a set of contract terms *if* we are enforcing wrapped contracts * * use this in the middle of your logic to make sure that you're happy * with everything up to this point * * @param callable $callback * function to call to check the set of contract terms * @param array $params * a list of parameters to pass into $callback * @return boolean * TRUE on success */ public static function checkThat($callback, $params = []) { CheckContracts::now($callback, $params); }