src.dualinventive.com/dinet/libdipp/common/ditest-php/test/test_framework.php

58 lines
1.1 KiB
PHP

<?php
require_once("../test_framework.php");
$t = new DiTest("Test Framework");
////
$t->step('equal()');
////
$t->equal(1, 1);
$t->equal(1, 2); // Fail == OK
$t->equal("foobar", "foobar");
$t->equal("foobar", "barfoo"); // Fail == OK
$t->equal(array("foo" => "bar"), array("foo" => "bar"));
$t->equal(array("foo" => "bar"), array("bar" => "foo")); // Fail == OK
////
$t->step('notEqual()');
////
$t->notEqual(1, 2);
$t->notEqual(1, 1); // Fail == OK
$t->notEqual("foobar", "barfoo");
$t->notEqual("foobar", "foobar"); // Fail == OK
$t->notEqual(array("foo" => "bar"), array("bar" => "foo"));
$t->notEqual(array("foo" => "bar"), array("foo" => "bar")); // Fail == OK
////
$t->step('isTrue()');
////
$t->isTrue(true);
$t->isTrue(false); // Fail == OK
////
$t->step('isFalse()');
////
$t->isFalse(false);
$t->isFalse(true); // Fail == OK
////
$t->step('summary()');
////
$summary = $t->summary();
var_dump($summary);
$t->endStep('', true);
if ($summary['pass'] == 8 &&
$summary['fail'] == 8 &&
$summary['skip'] == 0) {
$t->reset();
exit(0);
} else {
return $t->finish();
}