/** * @rebuild false */ public function testCollection() { $author = new Author(); $collection = $author->asCollection(); ok($collection); isa_ok('\\AuthorBooks\\Model\\AuthorCollection', $collection); }
function testClassUtils() { $obj = ClassUtils::newClass('test_classutils\\foo', array(1, 2, 3, 4, 5)); isa_ok('test_classutils\\foo', $obj); $this->assertEquals(1, $obj->v1); $this->assertEquals(2, $obj->v2); $obj = ClassUtils::newClass('test_classutils\\bar'); isa_ok('test_classutils\\bar', $obj); }
public function testViewTwigEngine() { $engine = \Phifty\View\Engine::createEngine('twig'); ok($engine); isa_ok('Phifty\\View\\Twig', $engine); # FIXME: # $result = $engine->render( 'test/twig.html' , array( 'Msg' => 'Hello World' ) ); # ok( $result ); # ok( strpos( $result , 'Hello World' ) !== false ); $engine2 = \Phifty\View\Engine::createEngine('twig'); $this->assertNotNull($engine2); $string = $engine2->renderString('Hello {{ name }}', array('name' => 'John')); $this->assertNotNull($string); ok(strpos($string, 'John') !== false); }
<?php $lib = isset($_SERVER['TESTLIB']) ? $_SERVER['TESTLIB'] : 'Test-More.php'; require_once $lib; #plan(3); diag('Test of various functions not otherwise broken out.'); pass("pass() is ok"); fail("fail() is not ok"); is('Ab3', 'Ab3', 'is() is ok'); isnt('Ab3', 123, 'isnt() is ok'); like('yackowackodot', '/wacko/', "like() is ok"); unlike('yackowackodot', '/boing/', "unlike() is ok"); cmp_ok(12, '>', 10, 'cmp_ok() is ok'); can_ok($__Test, 'plan'); isa_ok($__Test, 'TestMore', 'Default Testing object'); include_ok('t/goodlib.php'); require_ok('t/goodpage.php'); $foo = array(1, 'B', 'third'); $oof = array('third', 'B', 1); $bar = array('q' => 23, 'Y' => 42); $rab = array('Y' => 42, 'q' => 23); is_deeply($foo, $foo, 'is_deeply() is ok'); isnt_deeply($foo, $bar, 'isnt_deeply() is ok'); /* function skip($SkipReason, $num) { function todo ($why, $howmany) { function todo_skip ($why, $howmany) { function todo_start ($why) { function todo_end () { */ diag("Should fail 1 test, testing fail()");
/** * @rebuild false */ public function testDateTimeInflator() { $n = new \TestApp\Model\Name(); $date = new DateTime('2011-01-01 00:00:00'); $ret = $n->create(array('name' => 'Deflator Test', 'country' => 'Tokyo', 'confirmed' => false, 'date' => $date)); $this->assertResultSuccess($ret); $array = $n->toArray(); ok(is_string($array['date'])); $d = $n->date; // inflated isa_ok('DateTime', $d); is('20110101', $d->format('Ymd')); $this->successfulDelete($n); }
unlike("foo", '!oo!', 'unlike()'); check_capture(false); cmp_ok(1, '==', 2, 'cmp_ok()'); check_capture(false); cmp_ok(1, '>', 2, 'cmp_ok()'); check_capture(false); cmp_ok(2, '<', 1, 'cmp_ok()'); check_capture(false); can_ok($test_obj, array('foo', 'bar', 'baz')); check_capture(false); isa_ok($test_obj, 'TestClass2'); check_capture(false); fail('fail()'); check_capture(false); include_ok($dir.'/inc_false.php'); check_capture(false); require_ok($dir.'/inc_false.php'); check_capture(false); is_deeply($struct_1, $struct_2, 'is_deeply()'); check_capture(false); todo_begin("Testing");