/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. * * @return void */ protected function setUp() { $collection = new Collection(); foreach ($collection->getUsers() as $user) { $user->delete(); } unset($collection); $this->object = Model::fromArray(array('lastname' => 'Test', 'firstname' => 'Test', 'email' => '*****@*****.**', 'login' => 'test-user-model', 'user_acl_role_id' => 1, 'active' => true)); $this->object->setPassword('test-user-model-password'); $this->object->save(); }
/** * Test * * @return void */ public function testInit() { $collection = new UserCollection(); foreach ($collection->getUsers() as $user) { $user->delete(); } unset($collection); $userModel = UserModel::fromArray(array('lastname' => 'Test', 'firstname' => 'Test', 'email' => '*****@*****.**', 'login' => 'test-user-model', 'user_acl_role_id' => 1)); $userModel->setPassword('test-user-model-password'); $userModel->save(); $viewModel = ViewModel::fromArray(array('name' => 'View', 'identifier' => 'ViewIdentifier', 'description' => 'Description', 'content' => '')); $viewModel->save(); $documentTypeModel = DocumentTypeModel::fromArray(array('name' => 'DocumentType', 'description' => 'description', 'icon_id' => 1, 'default_view_id' => $viewModel->getId(), 'user_id' => $userModel->getId())); $documentTypeModel->save(); $form = new DocumentType(); $this->assertNull($form->init()); $viewModel->delete(); $documentTypeModel->delete(); $userModel->delete(); }
/** * List all roles * * @return \Zend\View\Model\ViewModel|array */ public function indexAction() { $userCollection = new User\Collection(); return array('users' => $userCollection->getUsers()); }