From f61a54c8dadb6c9ef2d5cd83e347f1f223f9655b Mon Sep 17 00:00:00 2001 From: lavafrank Date: Fri, 14 Jun 2019 12:39:50 -0400 Subject: [PATCH 1/2] solves issue #28 --- src/Action/User.php | 15 +-------------- tests/Action/ConversationTest.php | 2 -- tests/stubs/request-v2-google-userfull.json | 3 +-- tests/stubs/request-v2-google.json | 3 +-- 4 files changed, 3 insertions(+), 20 deletions(-) diff --git a/src/Action/User.php b/src/Action/User.php index e8e74fe..67b9202 100644 --- a/src/Action/User.php +++ b/src/Action/User.php @@ -7,9 +7,6 @@ class User { - /** @var string */ - protected $id; - /** @var null|Dialogflow\Action\User\Name */ protected $name; @@ -21,8 +18,6 @@ class User */ public function __construct($data) { - $this->id = $data['userId']; - if (isset($data['profile'])) { $this->name = new Name($data['profile']); } @@ -32,15 +27,7 @@ public function __construct($data) } } - /** - * Random string ID for Google user. - * - * @return string - */ - public function getId() - { - return $this->id; - } + /** * User's permissioned name info. diff --git a/tests/Action/ConversationTest.php b/tests/Action/ConversationTest.php index 9633fea..b8c59a5 100644 --- a/tests/Action/ConversationTest.php +++ b/tests/Action/ConversationTest.php @@ -370,7 +370,6 @@ public function testGetUser() $user = $conv->getUser(); - $this->assertEquals('ABwppHEW9NgaT5S1NmZYR42yhs0FW1hawZHSjC_xW8FwkoZU1GMoIRAWWoThwUcA7VNX22Jzj8-KqA', $user->getId()); $this->assertEquals(null, $user->getName()); $agent = $this->getAgent('googleuserfull'); @@ -378,7 +377,6 @@ public function testGetUser() $user = $conv->getUser(); - $this->assertEquals('ABwppHHRq4M6ZiJzBoAwy8WalWejgJDTZpHSj61TlzGgC1yJkQqA6OKsel7bvB-agBZiw', $user->getId()); $this->assertInstanceOf('\Dialogflow\Action\User\Name', $user->getName()); $this->assertEquals('Eris Ristemena', $user->getName()->getDisplay()); $this->assertEquals('Eris', $user->getName()->getGiven()); diff --git a/tests/stubs/request-v2-google-userfull.json b/tests/stubs/request-v2-google-userfull.json index 6bcdc1c..35cb3bc 100644 --- a/tests/stubs/request-v2-google-userfull.json +++ b/tests/stubs/request-v2-google-userfull.json @@ -87,8 +87,7 @@ "givenName":"Eris", "familyName":"Ristemena" }, - "locale":"en-US", - "userId":"ABwppHHRq4M6ZiJzBoAwy8WalWejgJDTZpHSj61TlzGgC1yJkQqA6OKsel7bvB-agBZiw" + "locale":"en-US" }, "device":{ "location":{ diff --git a/tests/stubs/request-v2-google.json b/tests/stubs/request-v2-google.json index caf0739..cfe68bd 100644 --- a/tests/stubs/request-v2-google.json +++ b/tests/stubs/request-v2-google.json @@ -121,8 +121,7 @@ "user":{ "userStorage":"{\"data\":{}}", "lastSeen":"2018-05-06T02:54:10Z", - "locale":"id-ID", - "userId":"ABwppHEW9NgaT5S1NmZYR42yhs0FW1hawZHSjC_xW8FwkoZU1GMoIRAWWoThwUcA7VNX22Jzj8-KqA" + "locale":"id-ID" }, "conversation":{ "conversationId":"1525587949165", From 4f5bb5466a995cb29218bc5578421ce4154c29be Mon Sep 17 00:00:00 2001 From: lavafrank Date: Fri, 14 Jun 2019 12:45:04 -0400 Subject: [PATCH 2/2] removed whitespace --- src/Action/User.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Action/User.php b/src/Action/User.php index 67b9202..f3ca7a2 100644 --- a/src/Action/User.php +++ b/src/Action/User.php @@ -26,9 +26,7 @@ public function __construct($data) $this->lastSeen = new Carbon($data['lastSeen']); } } - - - + /** * User's permissioned name info. *