Exemplo n.º 1
0
 public function testtoModel_AdminApiiArray()
 {
     $adminModel = new \Model_Admin();
     $adminModel->loadBean(new \RedBeanPHP\OODBBean());
     $adminGroupModel = new \Model_Admin();
     $adminGroupModel->loadBean(new \RedBeanPHP\OODBBean());
     $dbMock = $this->getMockBuilder('\\Box_Database')->getMock();
     $dbMock->expects($this->atLeastOnce())->method('load')->will($this->returnValue($adminGroupModel));
     $expected = array('id' => '', 'role' => '', 'admin_group_id' => '', 'email' => '', 'name' => '', 'status' => '', 'signature' => '', 'created_at' => '', 'updated_at' => '', 'protected' => '', 'group' => array('id' => '', 'name' => ''));
     $di = new \Box_Di();
     $di['db'] = $dbMock;
     $service = new \Box\Mod\Staff\Service();
     $service->setDi($di);
     $result = $service->toModel_AdminApiiArray($adminModel);
     $this->assertNotEmpty($result);
     $this->assertInternalType('array', $result);
     $this->assertTrue(count(array_diff(array_keys($expected), array_keys($result))) == 0, 'Missing array key values.');
 }