Preview::$config = $this->test_config; ok($message[0] == "before"); ok($total == 1); }); }); describe("#after_hook", function () { it("should run after the testsuite", function () { // start new env Preview::$world = $this->world; Preview::$config = $this->config; // -- test start -- $message = array(); $total = 0; $suite = new Suite("sample suite"); $suite->after(function () use(&$message, &$total) { $message[] = "after"; $total++; }); $suite->after_each(function () use(&$message) { $message[] = "then after_each"; }); $suite->test("add a new message", function () use(&$message) { $message[] = "it first"; }); $suite->test("add a new message", function () use(&$message) { $message[] = "it first"; }); $suite->load(); $this->world->run(); // -- test end -- // end new env Preview::$world = $this->test_world;