getChannel() public méthode

Get channel
public getChannel ( ) : string
Résultat string
Exemple #1
0
 public function testGetChannel()
 {
     $channelId = $this->faker->uuid;
     $message = new Message($this->client, ['id' => $this->faker->uuid, 'channel' => $channelId]);
     $this->mockResponse(200, null, ['ok' => true, 'channel' => ['id' => $channelId]]);
     $this->watchPromise($message->getChannel()->then(function (ChannelInterface $channel) use($channelId) {
         $this->assertEquals($channelId, $channel->getId());
     }));
 }
 /**
  * @covers Slack\Notifier::notify
  */
 public function testNotify()
 {
     $client = $this->getMockBuilder('\\Slack\\Client')->disableOriginalConstructor()->getMock(array('post'));
     $request = $this->getMockBuilder('\\Guzzle\\Http\\Message\\Request')->disableOriginalConstructor()->getMock(array('send'));
     $message = new Message('Hello world');
     $message->setChannel('#test')->setIconEmoji(':ghost:')->setUsername('slack-php');
     $attachment = new \Slack\Message\MessageAttachment();
     $field = new \Slack\Message\MessageField();
     $field->setTitle('foo')->setValue('bar')->setShort(false);
     $attachment->addField($field);
     $message->addAttachment($attachment);
     $expectedDatas = json_encode(array('text' => $message->getText(), 'channel' => $message->getChannel(), 'username' => 'slack-php', 'icon_emoji' => ':ghost:', 'attachments' => array(array('fields' => array(array('title' => 'foo', 'value' => 'bar', 'short' => false))))));
     $client->expects($this->once())->method('post')->with($this->equalTo('/services/hooks/incoming-webhook'), $this->anything(), $this->equalTo($expectedDatas), $this->anything())->will($this->returnValue($request));
     $notifier = new Notifier($client);
     $notifier->notify($message);
 }