コード例 #1
0
 public function __construct(\myfinance\FinanceContext $context)
 {
     $this->context = $context;
     $this->userId = $context->getUser()->id;
     $this->db = $this->context->getDb();
     $this->db->connect();
 }
コード例 #2
0
 public function testGetUser()
 {
     $dbMock = \Phake::mock('myfinance\\db\\DB');
     $userMock = \Phake::mock('myfinance\\model\\User');
     $context = new FinanceContext($dbMock, $userMock);
     $result = $context->getUser();
     $this->assertEquals($userMock, $result);
 }
コード例 #3
0
 public static function create(\myfinance\FinanceContext $context)
 {
     if ($context->getDb() instanceof \myfinance\db\MysqlDB) {
         return new \myfinance\repositories\MysqlQuotaRepository($context);
     } else {
         return new \myfinance\repositories\DummyQuotaRepository($context);
     }
 }