/**
  * @Transform /^channel "([^"]+)"$/
  * @Transform /^"([^"]+)" channel/
  * @Transform :channel
  */
 public function getChannelByName($channelName)
 {
     $channel = $this->channelRepository->findOneBy(['name' => $channelName]);
     if (null === $channel) {
         throw new \InvalidArgumentException('Channel with name "' . $channelName . '" does not exist');
     }
     return $channel;
 }
Exemple #2
0
 /**
  * @When I create a new channel :channelName
  */
 public function iCreateNewChannel($channelName)
 {
     $this->channelCreatePage->open();
     $this->channelCreatePage->nameIt($channelName);
     $this->channelCreatePage->specifyCode($channelName);
     $this->channelCreatePage->create();
     $channel = $this->channelRepository->findOneBy(['name' => $channelName]);
     $this->sharedStorage->set('channel', $channel);
 }
 function it_throws_an_exception_if_channel_is_not_found(ChannelRepositoryInterface $channelRepository)
 {
     $channelRepository->findOneBy(['name' => 'Store'])->willReturn(null);
     $this->shouldThrow(new \InvalidArgumentException('Channel with name "Store" does not exist'))->during('getChannelByName', ['Store']);
 }