/** * @spec */ public function testExceptionCombination() { when: 1 == 1; then: notThrown("RuntimeException"); _when: throw new \RuntimeException("test"); _then: thrown("RuntimeException"); }
/** * @spec * @test */ public function setupBlockWithCleanup() { setup: $temp = tmpfile(); when: fwrite($temp, "writing to tempfile"); then: notThrown('Exception'); when_: fseek($temp, 0); $data = fread($temp, 1024); then_: $data == "writing to tempfile"; cleanup: fclose($temp); // this removes the file according to tmpfile() docs }