Exemplo n.º 1
0
 /**
  * Test that a user can subscribe to a pusher channel
  *
  * @return void
  */
 public function testCanSubscribeMemberToPusherChannel()
 {
     $this->request->shouldReceive('input')->times(3)->andReturn('foo');
     $this->pusher->shouldReceive('presence_auth')->once()->with('foo', 'foo', m::type('string'), ['username' => 'foo']);
     $this->call('POST', 'pusher/auth');
     $this->assertResponseOk();
 }
Exemplo n.º 2
0
 /**
  * Test new messsages can be created by users
  *
  * @return void
  */
 public function testNewMessagesCanBeSaved()
 {
     $input = ['username' => 'foo', 'message' => 'bar'];
     $message = factory(Chatty\Message::class)->make($input);
     $this->request->shouldReceive('input')->andReturn($input);
     $this->messages->shouldReceive('create')->with($input)->andReturn($message);
     $this->expectsEvents(Chatty\Events\MessagePublished::class);
     $response = $this->call('POST', 'messages');
     $this->assertJsonStringEqualsJsonString($response->getContent(), $message->toJson());
     $this->assertEquals(201, $response->status());
 }