コード例 #1
0
ファイル: EntityContext.php プロジェクト: dstansby/camdram
 /**
  * @Given /^the society "([^"]*)"$/
  */
 public function createSociety($soc_name)
 {
     $society = new Society();
     $society->setName($soc_name)->setShortName($soc_name);
     $em = $this->getEntityManager();
     $em->persist($society);
     $em->flush();
     return $society;
 }
コード例 #2
0
ファイル: ShowVoterTest.php プロジェクト: dstansby/camdram
 public function testNotSocietyOwner()
 {
     $show = new Show();
     $society = new Society();
     $society->setName('Test Society');
     $show->setSociety($society);
     $this->aclProvider->expects($this->atLeastOnce())->method('isOwner')->with($this->user, $society)->will($this->returnValue(false));
     $this->assertEquals(ShowVoter::ACCESS_DENIED, $this->voter->vote($this->token, $show, array('EDIT')));
     $this->assertEquals(ShowVoter::ACCESS_DENIED, $this->voter->vote($this->token, $show, array('APPROVE')));
 }
コード例 #3
0
ファイル: SocietyFixtures.php プロジェクト: dstansby/camdram
 /**
  * {@inheritDoc}
  */
 public function load(ObjectManager $manager)
 {
     for ($i = 1; $i <= 10; $i++) {
         $society = new Society();
         $society->setName("Society {$i}");
         $society->setShortName("S-{$i}");
         $society->setDescription("Description of society {$i}");
         $manager->persist($society);
     }
     $manager->flush();
 }
コード例 #4
0
 public function testSubmitNameOnly()
 {
     $society = new Society();
     $society->setName('Test Society');
     $this->repo->expects($this->once())->method('findOneByName')->with('Test Society')->will($this->returnValue($society));
     $form = $this->createForm();
     $form->submit(['test' => null, 'test_name' => 'Test Society']);
     $data = $form->getData();
     $this->assertEquals($society, $data['test']);
     $this->assertEquals($society->getName(), $data['test_name']);
 }
コード例 #5
0
ファイル: OAuthTest.php プロジェクト: dstansby/camdram
 private function createSocietyWithOwner()
 {
     $em = $this->getEntityManager();
     $society = new Society();
     $society->setName('Test Society');
     $society->setShortName('Test Society');
     $em->persist($society);
     $em->flush();
     $aclProvider = $this->client->getContainer()->get('camdram.security.acl.provider');
     $aclProvider->grantAccess($society, $this->loginUser, $this->appUser);
 }
コード例 #6
0
ファイル: Show.php プロジェクト: dstansby/camdram
 public function getSocietyName()
 {
     if ($this->other_society) {
         return $this->other_society;
     } elseif ($this->society) {
         return $this->society->getName();
     }
 }