Create topic or a topic condition
Esempio n. 1
0
 /**
  * get Options transformed
  *
  * @return array
  */
 protected function getOptions()
 {
     $options = $this->options ? $this->options->toArray() : [];
     if ($this->topic && !$this->topic->hasOnlyOneTopic()) {
         $options = array_merge($options, $this->topic->build());
     }
     return $options;
 }
Esempio n. 2
0
 /**
  * @test
  */
 public function it_send_a_notification_to_a_topic_and_return_error()
 {
     $response = new Response(200, [], '{"error":"TopicsMessageRateExceeded"}');
     $client = Mockery::mock(Client::class);
     $client->shouldReceive('post')->once()->andReturn($response);
     $fcm = new FCMSender($client, 'http://test.test');
     $topics = new Topics();
     $topics->topic('test');
     $response = $fcm->sendToTopic($topics);
     $this->assertFalse($response->isSuccess());
     $this->assertTrue($response->shouldRetry());
     $this->assertEquals('TopicsMessageRateExceeded', $response->error());
 }