/** * @covers ::check */ public function testCanCheckIfWrappedContractsAreEnabled() { // ---------------------------------------------------------------- // setup your test WrappedContracts::disable(); $this->assertFalse(WrappedContracts::check()); // ---------------------------------------------------------------- // perform the change WrappedContracts::enable(); // ---------------------------------------------------------------- // test the results $this->assertTrue(WrappedContracts::check()); }
/** * @covers ::check */ public function testPassesParamsIntoCallback() { // ---------------------------------------------------------------- // setup your test $expectedParam1 = 5; $expectedParam2 = 3.1415927; $executed = false; $callback = function ($param1, $param2) use(&$executed, $expectedParam1, $expectedParam2) { $this->assertEquals($expectedParam1, $param1); $this->assertEquals($expectedParam2, $param2); $executed = true; }; WrappedContracts::enable(); // ---------------------------------------------------------------- // perform the change RunPreconditions::check($callback, [$expectedParam1, $expectedParam2]); // ---------------------------------------------------------------- // test the results $this->assertTrue($executed); }
public function setup() { Contracts\WrappedContracts::enable(); }