<?php /* * How to skip a test suite/case pending. */ namespace Preview\DSL\Testify; require_once __DIR__ . '/../ok.php'; $suite = new Suite("A sample test suite"); $suite->test("a skipped test case", "skip", function () { ok(true); }); $yasuite = new Suite("skipped suite", "skip"); $yasuite->test("a test case", function () { ok(true); }); // load this test suite. $yasuite->load(); $suite->load();
<?php namespace Preview\DSL\Testify; require_once 'ok.php'; $suite = new Suite("array functions"); $child = new Suite("String functions"); $suite->add_child($child); $child->test(function () { ok(true); }); $suite->before_each(function () { $this->arr = array(1, 2, 3, 4); }); $suite->test("array_push", function () { array_push($this->arr, 1); ok(end($this->arr) == 1); }); $suite->test("array_pop", "pop", function () { array_pop($this->arr); ok(end($this->arr) == 3); }); $suite->load();
<?php /* * How to group test in testify. */ namespace Preview\DSL\Testify; require_once __DIR__ . '/../ok.php'; $suite1 = new Suite("A grouped test suite", "group-2"); $suite1->test("a grouped and test case", "group-1", "group-2", function () { ok(true); }); $suite1->test("a grouped and skipped test case", "skip", "group-1", function () { ok(true); }); $suite2 = new Suite("grouped suite", "group-1", "group-2"); $suite2->test("a test case", function () { ok(true); }); $suite3 = new Suite("grouped and skipped test suite", "group-1", "skip", "group-2"); $suite3->test("a test case", function () { ok(true); }); // load this test suite. $suite1->load(); $suite2->load(); $suite3->load();