Пример #1
0
 });
 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;
         Preview::$config = $this->test_config;
         ok(end($message) == "after");
         ok($total == 1);