/** * @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; }
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'))); }
/** * {@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(); }
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']); }
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); }
public function getSocietyName() { if ($this->other_society) { return $this->other_society; } elseif ($this->society) { return $this->society->getName(); } }