{"action":"created","comment":{"url":"https://api.github.com/repos/baopham/laravel-dynamodb/pulls/comments/123770609","pull_request_review_id":46009538,"id":123770609,"diff_hunk":"@@ -0,0 +1,100 @@\n+<?php\n+\n+namespace BaoPham\\DynamoDb\\Tests;\n+\n+/**\n+ * Class DynamoDbModelTest\n+ *\n+ * @package BaoPham\\DynamoDb\\Tests\n+ */\n+class DynamoDbTimestampTest extends ModelTest\n+{\n+    protected function getTestModel()\n+    {\n+        return new TimestampModel([]);\n+    }\n+\n+    public function testCreateRecord()\n+    {\n+        \\Carbon\\Carbon::setTestNow(\\Carbon\\Carbon::create(2017, 06, 24, 5, 30, 0));\n+        $now = new \\Carbon\\Carbon;\n+        $this->testModel->id = str_random(36);\n+        $this->testModel->name = 'Test Create';\n+        $this->testModel->count = 1;\n+        $this->testModel->save();\n+\n+        $query = [\n+            'TableName' => $this->testModel->getTable(),\n+            'Key' => [\n+                'id' => ['S' => $this->testModel->id]\n+            ],\n+        ];\n+\n+        $record = $this->dynamoDbClient->getItem($query)->toArray();\n+\n+        $this->assertArrayHasKey('Item', $record);\n+        $this->assertEquals($this->testModel->created_at, $now);\n+    }\n+\n+    public function testUpdateRecord()\n+    {\n+        \\Carbon\\Carbon::setTestNow(\\Carbon\\Carbon::create(2017, 03, 01, 8, 30, 0));\n+        $now = new \\Carbon\\Carbon;\n+        $seed = $this->seed();\n+        $seedId = array_get($seed, 'id.S');\n+\n+        $newName = 'New Name';\n+        $this->testModel = $this->testModel->find($seedId);\n+        $updated = $this->testModel->update(['name' => $newName]);\n+\n+        $this->assertTrue($updated);\n+\n+        $query = [\n+            'TableName' => $this->testModel->getTable(),\n+            'Key' => [\n+                'id' => ['S' => $seedId]\n+            ],\n+        ];\n+\n+        $record = $this->dynamoDbClient->getItem($query)->toArray();\n+\n+        $this->assertEquals($this->testModel->updated_at, $now);\n+    }\n+\n+    protected function seed($attributes = [])\n+    {\n+        $item = [\n+            'id' => ['S' => str_random(36)],\n+            'name' => ['S' => str_random(36)],\n+            'description' => ['S' => str_random(256)],\n+            'count' => ['N' => rand()],\n+            'author' => ['S' => str_random()],\n+        ];\n+\n+        $item = array_merge($item, $attributes);\n+\n+        $this->dynamoDbClient->putItem([\n+            'TableName' => $this->testModel->getTable(),\n+            'Item' => $item,\n+        ]);\n+\n+        return $item;\n+    }\n+\n+}\n+\n+class TimestampModel extends \\BaoPham\\DynamoDb\\DynamoDbModel\n+{\n+    protected $fillable = ['name', 'description', 'count'];\n+\n+    protected $table = 'test_model';\n+\n+    public $timestamps = true;\n+\n+    protected $dynamoDbIndexKeys = [\n+        'count_index' => [\n+            'hash' => 'count',\n+        ],\n+    ];\n+}","path":"tests/DynamoDbTimestampTest.php","position":99,"original_position":99,"commit_id":"3478f08fd270be977a9620d22b291949af0dee4b","original_commit_id":"3478f08fd270be977a9620d22b291949af0dee4b","user":{"login":"Nitpick-CI","id":12626182,"avatar_url":"https://avatars2.githubusercontent.com/u/12626182?v=3","gravatar_id":"","url":"https://api.github.com/users/Nitpick-CI","html_url":"https://github.com/Nitpick-CI","followers_url":"https://api.github.com/users/Nitpick-CI/followers","following_url":"https://api.github.com/users/Nitpick-CI/following{/other_user}","gists_url":"https://api.github.com/users/Nitpick-CI/gists{/gist_id}","starred_url":"https://api.github.com/users/Nitpick-CI/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Nitpick-CI/subscriptions","organizations_url":"https://api.github.com/users/Nitpick-CI/orgs","repos_url":"https://api.github.com/users/Nitpick-CI/repos","events_url":"https://api.github.com/users/Nitpick-CI/events{/privacy}","received_events_url":"https://api.github.com/users/Nitpick-CI/received_events","type":"User","site_admin":false},"body":"Expected 1 blank line at end of file; 2 found","created_at":"2017-06-23T15:07:14Z","updated_at":"2017-06-23T15:07:14Z","html_url":"https://github.com/baopham/laravel-dynamodb/pull/58#discussion_r123770609","pull_request_url":"https://api.github.com/repos/baopham/laravel-dynamodb/pulls/58","_links":{"self":{"href":"https://api.github.com/repos/baopham/laravel-dynamodb/pulls/comments/123770609"},"html":{"href":"https://github.com/baopham/laravel-dynamodb/pull/58#discussion_r123770609"},"pull_request":{"href":"https://api.github.com/repos/baopham/laravel-dynamodb/pulls/58"}}},"pull_request":{"url":"https://api.github.com/repos/baopham/laravel-dynamodb/pulls/58","id":127033922,"html_url":"https://github.com/baopham/laravel-dynamodb/pull/58","diff_url":"https://github.com/baopham/laravel-dynamodb/pull/58.diff","patch_url":"https://github.com/baopham/laravel-dynamodb/pull/58.patch","issue_url":"https://api.github.com/repos/baopham/laravel-dynamodb/issues/58","number":58,"state":"open","locked":false,"title":"called syncOriginal() after setting attributes getAll() and find() - …","user":{"login":"zoul0813","id":1064917,"avatar_url":"https://avatars2.githubusercontent.com/u/1064917?v=3","gravatar_id":"","url":"https://api.github.com/users/zoul0813","html_url":"https://github.com/zoul0813","followers_url":"https://api.github.com/users/zoul0813/followers","following_url":"https://api.github.com/users/zoul0813/following{/other_user}","gists_url":"https://api.github.com/users/zoul0813/gists{/gist_id}","starred_url":"https://api.github.com/users/zoul0813/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zoul0813/subscriptions","organizations_url":"https://api.github.com/users/zoul0813/orgs","repos_url":"https://api.github.com/users/zoul0813/repos","events_url":"https://api.github.com/users/zoul0813/events{/privacy}","received_events_url":"https://api.github.com/users/zoul0813/received_events","type":"User","site_admin":false},"body":"added support for timestamps, and fixed \"isDirty\" logic (isDirty is required for timestamps to work properly).\n\n<!-- Reviewable:start -->\n---\nThis change is [<img src=\"https://reviewable.io/review_button.svg\" height=\"34\" align=\"absmiddle\" alt=\"Reviewable\"/>](https://reviewable.io/reviews/baopham/laravel-dynamodb/58)\n<!-- Reviewable:end -->\n","created_at":"2017-06-22T16:24:37Z","updated_at":"2017-06-23T15:07:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"16137fc8a8366de62fe17a03ed18d7f9dcaa0d7c","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/baopham/laravel-dynamodb/pulls/58/commits","review_comments_url":"https://api.github.com/repos/baopham/laravel-dynamodb/pulls/58/comments","review_comment_url":"https://api.github.com/repos/baopham/laravel-dynamodb/pulls/comments{/number}","comments_url":"https://api.github.com/repos/baopham/laravel-dynamodb/issues/58/comments","statuses_url":"https://api.github.com/repos/baopham/laravel-dynamodb/statuses/3478f08fd270be977a9620d22b291949af0dee4b","head":{"label":"zoul0813:feature/dirty-timestamps","ref":"feature/dirty-timestamps","sha":"3478f08fd270be977a9620d22b291949af0dee4b","user":{"login":"zoul0813","id":1064917,"avatar_url":"https://avatars2.githubusercontent.com/u/1064917?v=3","gravatar_id":"","url":"https://api.github.com/users/zoul0813","html_url":"https://github.com/zoul0813","followers_url":"https://api.github.com/users/zoul0813/followers","following_url":"https://api.github.com/users/zoul0813/following{/other_user}","gists_url":"https://api.github.com/users/zoul0813/gists{/gist_id}","starred_url":"https://api.github.com/users/zoul0813/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zoul0813/subscriptions","organizations_url":"https://api.github.com/users/zoul0813/orgs","repos_url":"https://api.github.com/users/zoul0813/repos","events_url":"https://api.github.com/users/zoul0813/events{/privacy}","received_events_url":"https://api.github.com/users/zoul0813/received_events","type":"User","site_admin":false},"repo":{"id":94455542,"name":"laravel-dynamodb","full_name":"zoul0813/laravel-dynamodb","owner":{"login":"zoul0813","id":1064917,"avatar_url":"https://avatars2.githubusercontent.com/u/1064917?v=3","gravatar_id":"","url":"https://api.github.com/users/zoul0813","html_url":"https://github.com/zoul0813","followers_url":"https://api.github.com/users/zoul0813/followers","following_url":"https://api.github.com/users/zoul0813/following{/other_user}","gists_url":"https://api.github.com/users/zoul0813/gists{/gist_id}","starred_url":"https://api.github.com/users/zoul0813/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zoul0813/subscriptions","organizations_url":"https://api.github.com/users/zoul0813/orgs","repos_url":"https://api.github.com/users/zoul0813/repos","events_url":"https://api.github.com/users/zoul0813/events{/privacy}","received_events_url":"https://api.github.com/users/zoul0813/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/zoul0813/laravel-dynamodb","description":"Eloquent syntax for DynamoDB ","fork":true,"url":"https://api.github.com/repos/zoul0813/laravel-dynamodb","forks_url":"https://api.github.com/repos/zoul0813/laravel-dynamodb/forks","keys_url":"https://api.github.com/repos/zoul0813/laravel-dynamodb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zoul0813/laravel-dynamodb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zoul0813/laravel-dynamodb/teams","hooks_url":"https://api.github.com/repos/zoul0813/laravel-dynamodb/hooks","issue_events_url":"https://api.github.com/repos/zoul0813/laravel-dynamodb/issues/events{/number}","events_url":"https://api.github.com/repos/zoul0813/laravel-dynamodb/events","assignees_url":"https://api.github.com/repos/zoul0813/laravel-dynamodb/assignees{/user}","branches_url":"https://api.github.com/repos/zoul0813/laravel-dynamodb/branches{/branch}","tags_url":"https://api.github.com/repos/zoul0813/laravel-dynamodb/tags","blobs_url":"https://api.github.com/repos/zoul0813/laravel-dynamodb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zoul0813/laravel-dynamodb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zoul0813/laravel-dynamodb/git/refs{/sha}","trees_url":"https://api.github.com/repos/zoul0813/laravel-dynamodb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zoul0813/laravel-dynamodb/statuses/{sha}","languages_url":"https://api.github.com/repos/zoul0813/laravel-dynamodb/languages","stargazers_url":"https://api.github.com/repos/zoul0813/laravel-dynamodb/stargazers","contributors_url":"https://api.github.com/repos/zoul0813/laravel-dynamodb/contributors","subscribers_url":"https://api.github.com/repos/zoul0813/laravel-dynamodb/subscribers","subscription_url":"https://api.github.com/repos/zoul0813/laravel-dynamodb/subscription","commits_url":"https://api.github.com/repos/zoul0813/laravel-dynamodb/commits{/sha}","git_commits_url":"https://api.github.com/repos/zoul0813/laravel-dynamodb/git/commits{/sha}","comments_url":"https://api.github.com/repos/zoul0813/laravel-dynamodb/comments{/number}","issue_comment_url":"https://api.github.com/repos/zoul0813/laravel-dynamodb/issues/comments{/number}","contents_url":"https://api.github.com/repos/zoul0813/laravel-dynamodb/contents/{+path}","compare_url":"https://api.github.com/repos/zoul0813/laravel-dynamodb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zoul0813/laravel-dynamodb/merges","archive_url":"https://api.github.com/repos/zoul0813/laravel-dynamodb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zoul0813/laravel-dynamodb/downloads","issues_url":"https://api.github.com/repos/zoul0813/laravel-dynamodb/issues{/number}","pulls_url":"https://api.github.com/repos/zoul0813/laravel-dynamodb/pulls{/number}","milestones_url":"https://api.github.com/repos/zoul0813/laravel-dynamodb/milestones{/number}","notifications_url":"https://api.github.com/repos/zoul0813/laravel-dynamodb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zoul0813/laravel-dynamodb/labels{/name}","releases_url":"https://api.github.com/repos/zoul0813/laravel-dynamodb/releases{/id}","deployments_url":"https://api.github.com/repos/zoul0813/laravel-dynamodb/deployments","created_at":"2017-06-15T15:53:41Z","updated_at":"2017-06-15T15:53:43Z","pushed_at":"2017-06-23T15:07:09Z","git_url":"git://github.com/zoul0813/laravel-dynamodb.git","ssh_url":"git@github.com:zoul0813/laravel-dynamodb.git","clone_url":"https://github.com/zoul0813/laravel-dynamodb.git","svn_url":"https://github.com/zoul0813/laravel-dynamodb","homepage":"https://packagist.org/packages/baopham/dynamodb","size":93969,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"baopham:master","ref":"master","sha":"2a300e6defbbd946d192cc7def7c4527e8d4e805","user":{"login":"baopham","id":783410,"avatar_url":"https://avatars0.githubusercontent.com/u/783410?v=3","gravatar_id":"","url":"https://api.github.com/users/baopham","html_url":"https://github.com/baopham","followers_url":"https://api.github.com/users/baopham/followers","following_url":"https://api.github.com/users/baopham/following{/other_user}","gists_url":"https://api.github.com/users/baopham/gists{/gist_id}","starred_url":"https://api.github.com/users/baopham/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/baopham/subscriptions","organizations_url":"https://api.github.com/users/baopham/orgs","repos_url":"https://api.github.com/users/baopham/repos","events_url":"https://api.github.com/users/baopham/events{/privacy}","received_events_url":"https://api.github.com/users/baopham/received_events","type":"User","site_admin":false},"repo":{"id":37164499,"name":"laravel-dynamodb","full_name":"baopham/laravel-dynamodb","owner":{"login":"baopham","id":783410,"avatar_url":"https://avatars0.githubusercontent.com/u/783410?v=3","gravatar_id":"","url":"https://api.github.com/users/baopham","html_url":"https://github.com/baopham","followers_url":"https://api.github.com/users/baopham/followers","following_url":"https://api.github.com/users/baopham/following{/other_user}","gists_url":"https://api.github.com/users/baopham/gists{/gist_id}","starred_url":"https://api.github.com/users/baopham/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/baopham/subscriptions","organizations_url":"https://api.github.com/users/baopham/orgs","repos_url":"https://api.github.com/users/baopham/repos","events_url":"https://api.github.com/users/baopham/events{/privacy}","received_events_url":"https://api.github.com/users/baopham/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/baopham/laravel-dynamodb","description":"Eloquent syntax for DynamoDB ","fork":false,"url":"https://api.github.com/repos/baopham/laravel-dynamodb","forks_url":"https://api.github.com/repos/baopham/laravel-dynamodb/forks","keys_url":"https://api.github.com/repos/baopham/laravel-dynamodb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/baopham/laravel-dynamodb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/baopham/laravel-dynamodb/teams","hooks_url":"https://api.github.com/repos/baopham/laravel-dynamodb/hooks","issue_events_url":"https://api.github.com/repos/baopham/laravel-dynamodb/issues/events{/number}","events_url":"https://api.github.com/repos/baopham/laravel-dynamodb/events","assignees_url":"https://api.github.com/repos/baopham/laravel-dynamodb/assignees{/user}","branches_url":"https://api.github.com/repos/baopham/laravel-dynamodb/branches{/branch}","tags_url":"https://api.github.com/repos/baopham/laravel-dynamodb/tags","blobs_url":"https://api.github.com/repos/baopham/laravel-dynamodb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/baopham/laravel-dynamodb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/baopham/laravel-dynamodb/git/refs{/sha}","trees_url":"https://api.github.com/repos/baopham/laravel-dynamodb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/baopham/laravel-dynamodb/statuses/{sha}","languages_url":"https://api.github.com/repos/baopham/laravel-dynamodb/languages","stargazers_url":"https://api.github.com/repos/baopham/laravel-dynamodb/stargazers","contributors_url":"https://api.github.com/repos/baopham/laravel-dynamodb/contributors","subscribers_url":"https://api.github.com/repos/baopham/laravel-dynamodb/subscribers","subscription_url":"https://api.github.com/repos/baopham/laravel-dynamodb/subscription","commits_url":"https://api.github.com/repos/baopham/laravel-dynamodb/commits{/sha}","git_commits_url":"https://api.github.com/repos/baopham/laravel-dynamodb/git/commits{/sha}","comments_url":"https://api.github.com/repos/baopham/laravel-dynamodb/comments{/number}","issue_comment_url":"https://api.github.com/repos/baopham/laravel-dynamodb/issues/comments{/number}","contents_url":"https://api.github.com/repos/baopham/laravel-dynamodb/contents/{+path}","compare_url":"https://api.github.com/repos/baopham/laravel-dynamodb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/baopham/laravel-dynamodb/merges","archive_url":"https://api.github.com/repos/baopham/laravel-dynamodb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/baopham/laravel-dynamodb/downloads","issues_url":"https://api.github.com/repos/baopham/laravel-dynamodb/issues{/number}","pulls_url":"https://api.github.com/repos/baopham/laravel-dynamodb/pulls{/number}","milestones_url":"https://api.github.com/repos/baopham/laravel-dynamodb/milestones{/number}","notifications_url":"https://api.github.com/repos/baopham/laravel-dynamodb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/baopham/laravel-dynamodb/labels{/name}","releases_url":"https://api.github.com/repos/baopham/laravel-dynamodb/releases{/id}","deployments_url":"https://api.github.com/repos/baopham/laravel-dynamodb/deployments","created_at":"2015-06-09T23:37:12Z","updated_at":"2017-06-21T17:45:02Z","pushed_at":"2017-06-23T15:07:11Z","git_url":"git://github.com/baopham/laravel-dynamodb.git","ssh_url":"git@github.com:baopham/laravel-dynamodb.git","clone_url":"https://github.com/baopham/laravel-dynamodb.git","svn_url":"https://github.com/baopham/laravel-dynamodb","homepage":"https://packagist.org/packages/baopham/dynamodb","size":93989,"stargazers_count":66,"watchers_count":66,"language":"PHP","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":27,"mirror_url":null,"open_issues_count":14,"forks":27,"open_issues":14,"watchers":66,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/baopham/laravel-dynamodb/pulls/58"},"html":{"href":"https://github.com/baopham/laravel-dynamodb/pull/58"},"issue":{"href":"https://api.github.com/repos/baopham/laravel-dynamodb/issues/58"},"comments":{"href":"https://api.github.com/repos/baopham/laravel-dynamodb/issues/58/comments"},"review_comments":{"href":"https://api.github.com/repos/baopham/laravel-dynamodb/pulls/58/comments"},"review_comment":{"href":"https://api.github.com/repos/baopham/laravel-dynamodb/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/baopham/laravel-dynamodb/pulls/58/commits"},"statuses":{"href":"https://api.github.com/repos/baopham/laravel-dynamodb/statuses/3478f08fd270be977a9620d22b291949af0dee4b"}}}}
{"actor":{"display_login":"Nitpick-CI"}}