/** * Checks if user's attributes are saved correctly when postAttributes() is called with an array of Attributes, that is * multiple Attributes. */ public function testPostAttributes_addsMultipleAttributesCount() { $this->jc->putUsers($this->newUser); $attrCount = count($this->jc->getAttributes($this->newUser)); $this->jc->postAttributes($this->newUser, $this->attrArr); $attr2Value = $this->jc->getAttributes($this->newUser); $newCount = count($attr2Value); $this->jc->deleteUser($this->newUser); $this->assertEquals($attrCount + 2, $newCount); $this->assertEquals('Anchor Steam', $attr2Value[1]->getAttrValue()); }
public function tearDown() { if ($this->newUser !== null) { $this->jc->deleteUser($this->newUser); } if ($this->newRole !== null) { $this->jc->deleteRole($this->newRole); } $this->newUser = null; $this->newRole = null; $this->jc = null; }
/** * Checks delRole() by actually deleting a Role from User. */ public function testRevokingARole_actuallyRevokesARole() { $user = JasperTestUtils::createUser(); $role = new Role('ROLE_DEMO', null, 'false'); $user->addRole($role); $this->jc->putUsers($user); $createdUser = $this->jc->getUsers($user->getUsername()); $createdUser = $createdUser[0]; $this->assertEquals(count($user->getRoles()), count($createdUser->getRoles())); $user->delRole($role); $this->jc->postUser($user); $updatedUser = $this->jc->getUsers($user->getUsername()); $updatedUser = $updatedUser[0]; $this->jc->deleteUser($user); $this->assertEquals(count($user->getRoles()), count($updatedUser->getRoles())); $this->assertEquals(count($createdUser->getRoles()) - 1, count($updatedUser->getRoles())); }