Example #1
0
 public function testgetServiceSub()
 {
     $mod = new Box_Mod('Invoice');
     $subServiceName = 'transaction';
     $subService = $mod->getService($subServiceName);
     $this->assertInstanceOf('\\Box\\Mod\\Invoice\\ServiceTransaction', $subService);
 }
Example #2
0
 public function testgetAdminNavigation()
 {
     $staffServiceMock = $this->getMockBuilder('\\Box\\Mod\\Staff\\Service')->getMock();
     $staffServiceMock->expects($this->atLeastOnce())->method('hasPermission')->will($this->returnValue(true));
     $pdoStatment = $this->getMockBuilder('\\Box\\Mod\\Extension\\PdoStatmentsMock')->getMock();
     $pdoStatment->expects($this->atLeastOnce())->method('execute');
     $pdoStatment->expects($this->atLeastOnce())->method('fetchAll')->will($this->returnValue(array()));
     $pdoMock = $this->getMockBuilder('\\Box\\Mod\\Extension\\PdoMock')->getMock();
     $pdoMock->expects($this->atLeastOnce())->method('prepare')->will($this->returnValue($pdoStatment));
     $link = 'extension';
     $urlMock = $this->getMockBuilder('Box_Url')->getMock();
     $urlMock->expects($this->atLeastOnce())->method('adminLink')->willReturn('http://boxbilling.com/index.php?_url=/' . $link);
     $di['url'] = $urlMock;
     $di = new \Box_Di();
     $di['mod'] = $di->protect(function ($name) use($di) {
         $mod = new \Box_Mod($name);
         $mod->setDi($di);
         return $mod;
     });
     $di['tools'] = new \Box_Tools();
     $di['mod_service'] = $di->protect(function () use($staffServiceMock) {
         return $staffServiceMock;
     });
     $di['pdo'] = $pdoMock;
     $di['url'] = $urlMock;
     $this->service->setDi($di);
     $result = $this->service->getAdminNavigation(new \Model_Admin());
     $this->assertInternalType('array', $result);
 }
Example #3
0
    $db->setDataMapper($mapper);
    return $db;
};
$di['pager'] = function () use($di) {
    $service = new Box_Pagination();
    $service->setDi($di);
    return $service;
};
$di['url'] = function () use($di) {
    $url = new Box_Url();
    $url->setDi($di);
    $url->setBaseUri(BB_URL);
    return $url;
};
$di['mod'] = $di->protect(function ($name) use($di) {
    $mod = new Box_Mod($name);
    $mod->setDi($di);
    return $mod;
});
$di['mod_service'] = $di->protect(function ($mod, $sub = '') use($di) {
    return $di['mod']($mod)->getService($sub);
});
$di['mod_config'] = $di->protect(function ($name) use($di) {
    return $di['mod']($name)->getConfig();
});
$di['events_manager'] = function () use($di) {
    $service = new Box_EventManager();
    $service->setDi($di);
    return $service;
};
$di['session'] = function () use($di) {