function testDb_TabledatagatewayId()
 {
     $db = new A_Db_Tabledatagateway_MockDb();
     $tdg = new Test1($db);
     $this->assertEqual($tdg->getKey(), 'id');
     $tdg = new Test1($db, '', 'bar');
     $this->assertEqual($tdg->getKey(), 'bar');
     $tdg = new Test2($db);
     $this->assertEqual($tdg->getKey(), 'code');
 }
Example #2
0
 protected function setUp()
 {
     if (self::$profileHandler === NULL) {
         self::$profileHandler = new TestValidationProfileHandler();
         self::$intentHandler = new TestIntentHandler();
         Engine::get()->addValidationProfileHandler(self::$profileHandler);
         Engine::get()->addIntentHandler(self::$intentHandler);
     }
 }
Example #3
0
<?php

header('content-type:text/html;charset=utf-8');
class Test1
{
    public $obj;
    public function fun1()
    {
        $this->obj = new Test2();
        return $this->obj;
    }
}
class Test2
{
    function fun3()
    {
        echo 'Tom<br/><br/>';
    }
    function fun4()
    {
        echo 'John<br/><br/>';
    }
}
$t = new Test1();
$t->fun1()->fun3();
Example #4
0
 * Date: 16/2/15
 * Time: 下午5:08
 */
/**
 *  SPL标准库
 */
// 5.3之前的版本
require 'Test1.php';
Test1::test();
function __autoload($class)
{
    require __DIR__ . '/' . $class . '.php';
}
// 5.3之后的版本
spl_autoload_register('autoload1');
Test1::test();
function autoload1($class)
{
    require __DIR__ . '/' . $class . '.php';
}
echo "\n------------- \n";
/*-----------常用数据结构------------------*/
// 栈  先进后出
$stack = new SplStack();
//入栈
$stack->push("data1 \n");
$stack->push("data2 \n");
//出栈
echo $stack->pop();
echo $stack->pop();
// 队列 先进先出
Example #5
0
 function __construct($value1, $value2, $value3)
 {
     parent::__construct($value1, $value2);
     $this->member2 = $value3;
 }