示例#1
0
 /**
  * @test
  */
 public function testyade()
 {
     require_once "Hoge.php";
     $hoge = new Hoge();
     $this->assertEquals("test", $hoge->testEcho());
     $this->assertEquals("test2", $hoge->test2Echo());
     $this->assertEquals("test4", $hoge->test3Echo());
 }
示例#2
0
<?php

require "Hoge.class.php";
$hoge1 = new Hoge(1000, 6);
$hoge1->start();
$hoge2 = new Hoge(2000, 3);
$hoge2->start();
示例#3
0
    }
    public function of($target)
    {
        return HermitDaoManager::get($target);
    }
}
class Foo
{
    public function get()
    {
        return HermitDaoManager::get(__CLASS__);
    }
}
class Bar
{
    public function get()
    {
        return HermitDaoManager::get(__CLASS__);
    }
}
$hoge = new Hoge();
$foo = new Foo();
$bar = new Bar();
$test->is($hoge->get(), 'A01Dao');
$test->is($hoge->of('Foo'), 'A02Dao');
$test->is($foo->get(), 'A02Dao');
$test->is($bar->get(), null);
$test->is(HermitDaoManager::has('Hoge'), true);
$test->is(HermitDaoManager::has('Foo'), true);
$test->is(HermitDaoManager::has('A01Dao'), false);
$test->is(HermitDaoManager::has('A02Dao'), false);
示例#4
0
<?php

/**
 * Legacy code for testing.
 */
class Hoge
{
    public function fuga()
    {
        return true;
    }
}
$hoge = new Hoge();
$result = $hoge->fuga();
if ($result) {
    exit;
}
class Foo
{
    public function bar()
    {
        echo 'foobar';
    }
}
$foo = new Foo();
$foo->bar();
示例#5
0
文件: hoge.php 项目: nowelium/Hermit
class Hoge
{
    private $dao;
    public function __construct()
    {
        //HermitDaoManager::set(__CLASS__, 'EmployeeDao');
        $this->dao = new Hermit('EmployeeDao');
    }
    public function getAll()
    {
        return $this->dao->getAllEmployeeList();
    }
    public function getOne()
    {
        return $this->dao->getEmployeeByEmpNo(7698);
    }
    public function getEmp()
    {
        $emp = new Employee();
        $emp->empno = 7566;
        $emp->ename = 'JONES';
        return $this->dao->getEmployee($emp);
    }
}
$pdo = new PDO('sqlite:' . dirname(__FILE__) . '/resource/employee.db');
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
HermitDataSourceManager::set('EmployeeDao', $pdo);
$hoge = new Hoge();
echo '[getAll] -----------------', var_export($hoge->getAll(), true), PHP_EOL;
echo '[getOne] -----------------', var_export($hoge->getOne(), true), PHP_EOL;
echo '[getEmp] -----------------', var_export($hoge->getEmp(), true), PHP_EOL;
示例#6
0
<?php

require_once "Hoge.php";
$hoge = new Hoge();
$hoge->testEcho();