Skip to content

Commit

Permalink
Merge pull request #3 from DanielCoulbourne/master
Browse files Browse the repository at this point in the history
Change IncomingMessage construction in TwilioMessageDriver to use 'From' as the sender.
  • Loading branch information
mpociot authored Mar 19, 2018
2 parents d8cfb35 + d65fa9f commit 5226459
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/TwilioMessageDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function getConversationAnswer(IncomingMessage $message)
public function getMessages()
{
if (empty($this->messages)) {
$message = new IncomingMessage($this->event->get('Body'), $this->event->get('MessageSid'), $this->event->get('To'));
$message = new IncomingMessage($this->event->get('Body'), $this->event->get('From'), $this->event->get('To'));

$this->messages = [$message];
}
Expand Down
4 changes: 2 additions & 2 deletions tests/TwilioMessageDriverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public function it_detects_bots()
public function it_returns_the_user_id()
{
$driver = $this->getValidDriver();
$this->assertSame('CA69d45cb4f204d9e790f24e0151e90fa9', $driver->getMessages()[0]->getSender());
$this->assertSame('+431234567890', $driver->getMessages()[0]->getSender());
}

/** @test */
Expand All @@ -126,7 +126,7 @@ public function it_returns_the_user_object()
$message = $driver->getMessages()[0];
$user = $driver->getUser($message);

$this->assertSame($user->getId(), 'CA69d45cb4f204d9e790f24e0151e90fa9');
$this->assertSame($user->getId(), '+431234567890');
$this->assertNull($user->getFirstName());
$this->assertNull($user->getLastName());
$this->assertNull($user->getUsername());
Expand Down

0 comments on commit 5226459

Please sign in to comment.