public function testPutOrganizationActionIsProtected()
 {
     $orga = $this->persister->organization('orga');
     $this->persister->flush();
     $this->logIn($this->john);
     $fields = array('name' => 'rename', 'email' => '*****@*****.**', 'administrators' => $this->admin->getId());
     $form = array('organization_form' => $fields);
     $this->client->request('PUT', "/api/organizations/{$orga->getId()}.json", $form);
     $this->assertEquals(403, $this->client->getResponse()->getStatusCode());
 }
Пример #2
0
 protected function setUp()
 {
     parent::setUp();
     $this->persister = $this->client->getContainer()->get('claroline.library.testing.persister');
     //users
     $this->john = $this->persister->user('john');
     $roleAdmin = $this->persister->role('ROLE_ADMIN');
     $this->teacherRole = $this->persister->role('ROLE_TEACHER');
     $this->baseRole = $this->persister->role('ROLE_BASE');
     $this->admin = $this->persister->user('admin');
     $this->admin->addRole($roleAdmin);
     //organization
     $organization = $this->persister->organization('organization');
     $this->adminOrga = $this->persister->user('adminOrga');
     $this->groupOrga = $this->persister->group('groupOrga');
     $this->groupOrga->addRole($this->baseRole);
     $this->groupBase = $this->persister->group('groupBase');
     $this->groupOrga->addOrganization($organization);
     $this->adminOrga->addAdministratedOrganization($organization);
     //persist
     $this->persister->persist($this->groupOrga);
     $this->persister->persist($this->adminOrga);
     $this->persister->persist($this->admin);
     $this->persister->flush();
 }