From 9e8ba91de767d0ca719772c8cfed8c350a45d21d Mon Sep 17 00:00:00 2001 From: aihara005 Date: Thu, 12 Jul 2018 00:01:31 +0900 Subject: [PATCH 1/7] =?UTF-8?q?PHPUnit=E3=83=86=E3=82=B9=E3=83=88=E3=82=B5?= =?UTF-8?q?=E3=83=B3=E3=83=97=E3=83=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/Feature/ExampleTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Feature/ExampleTest.php b/tests/Feature/ExampleTest.php index f31e495..95db0f2 100644 --- a/tests/Feature/ExampleTest.php +++ b/tests/Feature/ExampleTest.php @@ -14,7 +14,7 @@ class ExampleTest extends TestCase */ public function testBasicTest() { - $response = $this->get('/'); + $response = $this->get('/posts'); $response->assertStatus(200); } From ba2e4b8343bbad7fe9ddbdd3623609c474b540b1 Mon Sep 17 00:00:00 2001 From: aihara005 Date: Thu, 12 Jul 2018 00:31:44 +0900 Subject: [PATCH 2/7] =?UTF-8?q?Post=E4=B8=80=E8=A6=A7=E5=8F=96=E5=BE=97API?= =?UTF-8?q?=E3=81=AE=E3=83=86=E3=82=B9=E3=83=88=E3=82=B3=E3=83=BC=E3=83=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/Feature/PostsTest.php | 38 +++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 tests/Feature/PostsTest.php diff --git a/tests/Feature/PostsTest.php b/tests/Feature/PostsTest.php new file mode 100644 index 0000000..e4da5fd --- /dev/null +++ b/tests/Feature/PostsTest.php @@ -0,0 +1,38 @@ +get('/posts'); + + $response->assertStatus(200) + ->assertJsonStructure([ + 'data' => [ + '*' => [ + 'id', + 'title', + 'body', + + 'comments' => [ + '*' => [ + 'id', + 'post_id', + 'body' + ] + ] + ] + ] + ]); + } +} From a334a6f210a56d1b71a07c641d3196ac181cfc60 Mon Sep 17 00:00:00 2001 From: aihara005 Date: Thu, 12 Jul 2018 00:32:03 +0900 Subject: [PATCH 3/7] =?UTF-8?q?phpunit=E3=81=AA=E3=81=A9=E3=83=90=E3=83=BC?= =?UTF-8?q?=E3=82=B8=E3=83=A7=E3=83=B3=E3=82=A2=E3=83=83=E3=83=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.json | 2 +- composer.lock | 367 ++++++++++++++++++++++---------------------------- 2 files changed, 162 insertions(+), 207 deletions(-) diff --git a/composer.json b/composer.json index 0aa7120..c119c14 100644 --- a/composer.json +++ b/composer.json @@ -14,7 +14,7 @@ "filp/whoops": "~2.0", "fzaninotto/faker": "~1.4", "mockery/mockery": "~1.0", - "phpunit/phpunit": "~6.0", + "phpunit/phpunit": "7.*", "symfony/thanks": "^1.0" }, "autoload": { diff --git a/composer.lock b/composer.lock index 2621399..3e36760 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "b7904d07d1e1765a0a199aa11d6301a3", + "content-hash": "e0b697c09d0c64993cd6fecd65c53da1", "packages": [ { "name": "dnoegel/php-xdg-base-dir", @@ -812,16 +812,16 @@ }, { "name": "nesbot/carbon", - "version": "1.30.0", + "version": "1.32.0", "source": { "type": "git", "url": "https://github.com/briannesbitt/Carbon.git", - "reference": "863a1a651ea324e1838da3a52753a4239b9d4bea" + "reference": "64563e2b9f69e4db1b82a60e81efa327a30ff343" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/863a1a651ea324e1838da3a52753a4239b9d4bea", - "reference": "863a1a651ea324e1838da3a52753a4239b9d4bea", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/64563e2b9f69e4db1b82a60e81efa327a30ff343", + "reference": "64563e2b9f69e4db1b82a60e81efa327a30ff343", "shasum": "" }, "require": { @@ -833,6 +833,13 @@ "phpunit/phpunit": "^4.8.35 || ^5.7" }, "type": "library", + "extra": { + "laravel": { + "providers": [ + "Carbon\\Laravel\\ServiceProvider" + ] + } + }, "autoload": { "psr-4": { "": "src/" @@ -856,7 +863,7 @@ "datetime", "time" ], - "time": "2018-06-15T11:52:26+00:00" + "time": "2018-07-05T06:59:26+00:00" }, { "name": "nikic/php-parser", @@ -911,16 +918,16 @@ }, { "name": "paragonie/random_compat", - "version": "v2.0.15", + "version": "v2.0.17", "source": { "type": "git", "url": "https://github.com/paragonie/random_compat.git", - "reference": "10bcb46e8f3d365170f6de9d05245aa066b81f09" + "reference": "29af24f25bab834fcbb38ad2a69fa93b867e070d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/paragonie/random_compat/zipball/10bcb46e8f3d365170f6de9d05245aa066b81f09", - "reference": "10bcb46e8f3d365170f6de9d05245aa066b81f09", + "url": "https://api.github.com/repos/paragonie/random_compat/zipball/29af24f25bab834fcbb38ad2a69fa93b867e070d", + "reference": "29af24f25bab834fcbb38ad2a69fa93b867e070d", "shasum": "" }, "require": { @@ -956,7 +963,7 @@ "pseudorandom", "random" ], - "time": "2018-06-08T15:26:40+00:00" + "time": "2018-07-04T16:31:37+00:00" }, { "name": "psr/container", @@ -1256,16 +1263,16 @@ }, { "name": "swiftmailer/swiftmailer", - "version": "v6.0.2", + "version": "v6.1.1", "source": { "type": "git", "url": "https://github.com/swiftmailer/swiftmailer.git", - "reference": "412333372fb6c8ffb65496a2bbd7321af75733fc" + "reference": "aa899fef280b1c1aec8d5d4ac069af7f80c89a23" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/412333372fb6c8ffb65496a2bbd7321af75733fc", - "reference": "412333372fb6c8ffb65496a2bbd7321af75733fc", + "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/aa899fef280b1c1aec8d5d4ac069af7f80c89a23", + "reference": "aa899fef280b1c1aec8d5d4ac069af7f80c89a23", "shasum": "" }, "require": { @@ -1276,10 +1283,14 @@ "mockery/mockery": "~0.9.1", "symfony/phpunit-bridge": "~3.3@dev" }, + "suggest": { + "ext-intl": "Needed to support internationalized email addresses", + "true/punycode": "Needed to support internationalized email addresses, if ext-intl is not installed" + }, "type": "library", "extra": { "branch-alias": { - "dev-master": "6.0-dev" + "dev-master": "6.1-dev" } }, "autoload": { @@ -1301,26 +1312,26 @@ } ], "description": "Swiftmailer, free feature-rich PHP mailer", - "homepage": "http://swiftmailer.symfony.com", + "homepage": "https://swiftmailer.symfony.com", "keywords": [ "email", "mail", "mailer" ], - "time": "2017-09-30T22:39:41+00:00" + "time": "2018-07-04T11:12:44+00:00" }, { "name": "symfony/console", - "version": "v3.4.11", + "version": "v3.4.12", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "36f83f642443c46f3cf751d4d2ee5d047d757a27" + "reference": "1b97071a26d028c9bd4588264e101e14f6e7cd00" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/36f83f642443c46f3cf751d4d2ee5d047d757a27", - "reference": "36f83f642443c46f3cf751d4d2ee5d047d757a27", + "url": "https://api.github.com/repos/symfony/console/zipball/1b97071a26d028c9bd4588264e101e14f6e7cd00", + "reference": "1b97071a26d028c9bd4588264e101e14f6e7cd00", "shasum": "" }, "require": { @@ -1376,11 +1387,11 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2018-05-16T08:49:21+00:00" + "time": "2018-05-23T05:02:55+00:00" }, { "name": "symfony/css-selector", - "version": "v4.1.0", + "version": "v4.1.1", "source": { "type": "git", "url": "https://github.com/symfony/css-selector.git", @@ -1433,16 +1444,16 @@ }, { "name": "symfony/debug", - "version": "v3.4.11", + "version": "v3.4.12", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", - "reference": "b28fd73fefbac341f673f5efd707d539d6a19f68" + "reference": "47e6788c5b151cf0cfdf3329116bf33800632d75" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/b28fd73fefbac341f673f5efd707d539d6a19f68", - "reference": "b28fd73fefbac341f673f5efd707d539d6a19f68", + "url": "https://api.github.com/repos/symfony/debug/zipball/47e6788c5b151cf0cfdf3329116bf33800632d75", + "reference": "47e6788c5b151cf0cfdf3329116bf33800632d75", "shasum": "" }, "require": { @@ -1485,11 +1496,11 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "time": "2018-05-16T14:03:39+00:00" + "time": "2018-06-25T11:10:40+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v4.1.0", + "version": "v4.1.1", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", @@ -1552,16 +1563,16 @@ }, { "name": "symfony/finder", - "version": "v3.4.11", + "version": "v3.4.12", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "472a92f3df8b247b49ae364275fb32943b9656c6" + "reference": "3a8c3de91d2b2c68cd2d665cf9d00f7ef9eaa394" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/472a92f3df8b247b49ae364275fb32943b9656c6", - "reference": "472a92f3df8b247b49ae364275fb32943b9656c6", + "url": "https://api.github.com/repos/symfony/finder/zipball/3a8c3de91d2b2c68cd2d665cf9d00f7ef9eaa394", + "reference": "3a8c3de91d2b2c68cd2d665cf9d00f7ef9eaa394", "shasum": "" }, "require": { @@ -1597,20 +1608,20 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2018-05-16T08:49:21+00:00" + "time": "2018-06-19T20:52:10+00:00" }, { "name": "symfony/http-foundation", - "version": "v3.4.11", + "version": "v3.4.12", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "a7b5fc605d1c215cea1122359044b1e682eb70c0" + "reference": "1c28679fcbb0d9b35e4fd49fbb74d2ca4ea17bce" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/a7b5fc605d1c215cea1122359044b1e682eb70c0", - "reference": "a7b5fc605d1c215cea1122359044b1e682eb70c0", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/1c28679fcbb0d9b35e4fd49fbb74d2ca4ea17bce", + "reference": "1c28679fcbb0d9b35e4fd49fbb74d2ca4ea17bce", "shasum": "" }, "require": { @@ -1651,20 +1662,20 @@ ], "description": "Symfony HttpFoundation Component", "homepage": "https://symfony.com", - "time": "2018-05-25T11:07:31+00:00" + "time": "2018-06-21T11:10:19+00:00" }, { "name": "symfony/http-kernel", - "version": "v3.4.11", + "version": "v3.4.12", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "3dac45df55ee0c5134c457a730cd68e2a2ce0445" + "reference": "cb7edcdc47cab3c61c891e6e55337f8dd470d820" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/3dac45df55ee0c5134c457a730cd68e2a2ce0445", - "reference": "3dac45df55ee0c5134c457a730cd68e2a2ce0445", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/cb7edcdc47cab3c61c891e6e55337f8dd470d820", + "reference": "cb7edcdc47cab3c61c891e6e55337f8dd470d820", "shasum": "" }, "require": { @@ -1672,7 +1683,7 @@ "psr/log": "~1.0", "symfony/debug": "~2.8|~3.0|~4.0", "symfony/event-dispatcher": "~2.8|~3.0|~4.0", - "symfony/http-foundation": "^3.4.4|^4.0.4", + "symfony/http-foundation": "~3.4.12|~4.0.12|^4.1.1", "symfony/polyfill-ctype": "~1.8" }, "conflict": { @@ -1740,7 +1751,7 @@ ], "description": "Symfony HttpKernel Component", "homepage": "https://symfony.com", - "time": "2018-05-25T13:16:28+00:00" + "time": "2018-06-25T12:29:19+00:00" }, { "name": "symfony/polyfill-ctype", @@ -1917,16 +1928,16 @@ }, { "name": "symfony/process", - "version": "v3.4.11", + "version": "v3.4.12", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "4cbf2db9abcb01486a21b7a059e03a62fae63187" + "reference": "acc5a37c706ace827962851b69705b24e71ca17c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/4cbf2db9abcb01486a21b7a059e03a62fae63187", - "reference": "4cbf2db9abcb01486a21b7a059e03a62fae63187", + "url": "https://api.github.com/repos/symfony/process/zipball/acc5a37c706ace827962851b69705b24e71ca17c", + "reference": "acc5a37c706ace827962851b69705b24e71ca17c", "shasum": "" }, "require": { @@ -1962,20 +1973,20 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2018-05-16T08:49:21+00:00" + "time": "2018-05-30T04:24:30+00:00" }, { "name": "symfony/routing", - "version": "v3.4.11", + "version": "v3.4.12", "source": { "type": "git", "url": "https://github.com/symfony/routing.git", - "reference": "e382da877f5304aabc12ec3073eec430670c8296" + "reference": "6b9fef5343828e542db17e2519722ef08992f2c1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/routing/zipball/e382da877f5304aabc12ec3073eec430670c8296", - "reference": "e382da877f5304aabc12ec3073eec430670c8296", + "url": "https://api.github.com/repos/symfony/routing/zipball/6b9fef5343828e542db17e2519722ef08992f2c1", + "reference": "6b9fef5343828e542db17e2519722ef08992f2c1", "shasum": "" }, "require": { @@ -1988,7 +1999,6 @@ }, "require-dev": { "doctrine/annotations": "~1.0", - "doctrine/common": "~2.2", "psr/log": "~1.0", "symfony/config": "^3.3.1|~4.0", "symfony/dependency-injection": "~3.3|~4.0", @@ -2040,20 +2050,20 @@ "uri", "url" ], - "time": "2018-05-16T12:49:49+00:00" + "time": "2018-06-19T20:52:10+00:00" }, { "name": "symfony/translation", - "version": "v4.1.0", + "version": "v4.1.1", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "16328f5b217cebc8dd4adfe4aeeaa8c377581f5a" + "reference": "b6d8164085ee0b6debcd1b7a131fd6f63bb04854" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/16328f5b217cebc8dd4adfe4aeeaa8c377581f5a", - "reference": "16328f5b217cebc8dd4adfe4aeeaa8c377581f5a", + "url": "https://api.github.com/repos/symfony/translation/zipball/b6d8164085ee0b6debcd1b7a131fd6f63bb04854", + "reference": "b6d8164085ee0b6debcd1b7a131fd6f63bb04854", "shasum": "" }, "require": { @@ -2109,20 +2119,20 @@ ], "description": "Symfony Translation Component", "homepage": "https://symfony.com", - "time": "2018-05-30T07:26:09+00:00" + "time": "2018-06-22T08:59:39+00:00" }, { "name": "symfony/var-dumper", - "version": "v3.4.11", + "version": "v3.4.12", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "0e6545672d8c9ce70dd472adc2f8b03155a46f73" + "reference": "e173954a28a44a32c690815fbe4d0f2eac43accb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/0e6545672d8c9ce70dd472adc2f8b03155a46f73", - "reference": "0e6545672d8c9ce70dd472adc2f8b03155a46f73", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/e173954a28a44a32c690815fbe4d0f2eac43accb", + "reference": "e173954a28a44a32c690815fbe4d0f2eac43accb", "shasum": "" }, "require": { @@ -2178,7 +2188,7 @@ "debug", "dump" ], - "time": "2018-04-26T12:42:15+00:00" + "time": "2018-06-15T07:47:49+00:00" }, { "name": "tijsverkoyen/css-to-inline-styles", @@ -2229,28 +2239,28 @@ }, { "name": "vlucas/phpdotenv", - "version": "v2.4.0", + "version": "v2.5.0", "source": { "type": "git", "url": "https://github.com/vlucas/phpdotenv.git", - "reference": "3cc116adbe4b11be5ec557bf1d24dc5e3a21d18c" + "reference": "6ae3e2e6494bb5e58c2decadafc3de7f1453f70a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/3cc116adbe4b11be5ec557bf1d24dc5e3a21d18c", - "reference": "3cc116adbe4b11be5ec557bf1d24dc5e3a21d18c", + "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/6ae3e2e6494bb5e58c2decadafc3de7f1453f70a", + "reference": "6ae3e2e6494bb5e58c2decadafc3de7f1453f70a", "shasum": "" }, "require": { "php": ">=5.3.9" }, "require-dev": { - "phpunit/phpunit": "^4.8 || ^5.0" + "phpunit/phpunit": "^4.8.35 || ^5.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.4-dev" + "dev-master": "2.5-dev" } }, "autoload": { @@ -2260,7 +2270,7 @@ }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause-Attribution" + "BSD-3-Clause" ], "authors": [ { @@ -2275,7 +2285,7 @@ "env", "environment" ], - "time": "2016-09-01T10:05:43+00:00" + "time": "2018-07-01T10:25:50+00:00" } ], "packages-dev": [ @@ -2925,40 +2935,40 @@ }, { "name": "phpunit/php-code-coverage", - "version": "5.3.2", + "version": "6.0.7", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "c89677919c5dd6d3b3852f230a663118762218ac" + "reference": "865662550c384bc1db7e51d29aeda1c2c161d69a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/c89677919c5dd6d3b3852f230a663118762218ac", - "reference": "c89677919c5dd6d3b3852f230a663118762218ac", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/865662550c384bc1db7e51d29aeda1c2c161d69a", + "reference": "865662550c384bc1db7e51d29aeda1c2c161d69a", "shasum": "" }, "require": { "ext-dom": "*", "ext-xmlwriter": "*", - "php": "^7.0", - "phpunit/php-file-iterator": "^1.4.2", + "php": "^7.1", + "phpunit/php-file-iterator": "^2.0", "phpunit/php-text-template": "^1.2.1", - "phpunit/php-token-stream": "^2.0.1", + "phpunit/php-token-stream": "^3.0", "sebastian/code-unit-reverse-lookup": "^1.0.1", - "sebastian/environment": "^3.0", + "sebastian/environment": "^3.1", "sebastian/version": "^2.0.1", "theseer/tokenizer": "^1.1" }, "require-dev": { - "phpunit/phpunit": "^6.0" + "phpunit/phpunit": "^7.0" }, "suggest": { - "ext-xdebug": "^2.5.5" + "ext-xdebug": "^2.6.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.3.x-dev" + "dev-master": "6.0-dev" } }, "autoload": { @@ -2984,29 +2994,29 @@ "testing", "xunit" ], - "time": "2018-04-06T15:36:58+00:00" + "time": "2018-06-01T07:51:50+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "1.4.5", + "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4" + "reference": "cecbc684605bb0cc288828eb5d65d93d5c676d3c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/730b01bc3e867237eaac355e06a36b85dd93a8b4", - "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cecbc684605bb0cc288828eb5d65d93d5c676d3c", + "reference": "cecbc684605bb0cc288828eb5d65d93d5c676d3c", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { @@ -3021,7 +3031,7 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], @@ -3031,7 +3041,7 @@ "filesystem", "iterator" ], - "time": "2017-11-27T13:52:08+00:00" + "time": "2018-06-11T11:44:00+00:00" }, { "name": "phpunit/php-text-template", @@ -3076,28 +3086,28 @@ }, { "name": "phpunit/php-timer", - "version": "1.0.9", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f" + "reference": "8b8454ea6958c3dee38453d3bd571e023108c91f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", - "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/8b8454ea6958c3dee38453d3bd571e023108c91f", + "reference": "8b8454ea6958c3dee38453d3bd571e023108c91f", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0" + "php": "^7.1" }, "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" + "phpunit/phpunit": "^7.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -3112,7 +3122,7 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], @@ -3121,33 +3131,33 @@ "keywords": [ "timer" ], - "time": "2017-02-26T11:10:40+00:00" + "time": "2018-02-01T13:07:23+00:00" }, { "name": "phpunit/php-token-stream", - "version": "2.0.2", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "791198a2c6254db10131eecfe8c06670700904db" + "reference": "21ad88bbba7c3d93530d93994e0a33cd45f02ace" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/791198a2c6254db10131eecfe8c06670700904db", - "reference": "791198a2c6254db10131eecfe8c06670700904db", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/21ad88bbba7c3d93530d93994e0a33cd45f02ace", + "reference": "21ad88bbba7c3d93530d93994e0a33cd45f02ace", "shasum": "" }, "require": { "ext-tokenizer": "*", - "php": "^7.0" + "php": "^7.1" }, "require-dev": { - "phpunit/phpunit": "^6.2.4" + "phpunit/phpunit": "^7.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -3170,40 +3180,40 @@ "keywords": [ "tokenizer" ], - "time": "2017-11-27T05:48:46+00:00" + "time": "2018-02-01T13:16:43+00:00" }, { "name": "phpunit/phpunit", - "version": "6.5.8", + "version": "7.2.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "4f21a3c6b97c42952fd5c2837bb354ec0199b97b" + "reference": "400a3836ee549ae6f665323ac3f21e27eac7155f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/4f21a3c6b97c42952fd5c2837bb354ec0199b97b", - "reference": "4f21a3c6b97c42952fd5c2837bb354ec0199b97b", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/400a3836ee549ae6f665323ac3f21e27eac7155f", + "reference": "400a3836ee549ae6f665323ac3f21e27eac7155f", "shasum": "" }, "require": { + "doctrine/instantiator": "^1.1", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", "ext-mbstring": "*", "ext-xml": "*", - "myclabs/deep-copy": "^1.6.1", + "myclabs/deep-copy": "^1.7", "phar-io/manifest": "^1.0.1", "phar-io/version": "^1.0", - "php": "^7.0", + "php": "^7.1", "phpspec/prophecy": "^1.7", - "phpunit/php-code-coverage": "^5.3", - "phpunit/php-file-iterator": "^1.4.3", + "phpunit/php-code-coverage": "^6.0.7", + "phpunit/php-file-iterator": "^2.0.1", "phpunit/php-text-template": "^1.2.1", - "phpunit/php-timer": "^1.0.9", - "phpunit/phpunit-mock-objects": "^5.0.5", - "sebastian/comparator": "^2.1", - "sebastian/diff": "^2.0", + "phpunit/php-timer": "^2.0", + "sebastian/comparator": "^3.0", + "sebastian/diff": "^3.0", "sebastian/environment": "^3.1", "sebastian/exporter": "^3.1", "sebastian/global-state": "^2.0", @@ -3212,15 +3222,15 @@ "sebastian/version": "^2.0.1" }, "conflict": { - "phpdocumentor/reflection-docblock": "3.0.2", - "phpunit/dbunit": "<3.0" + "phpunit/phpunit-mock-objects": "*" }, "require-dev": { "ext-pdo": "*" }, "suggest": { + "ext-soap": "*", "ext-xdebug": "*", - "phpunit/php-invoker": "^1.1" + "phpunit/php-invoker": "^2.0" }, "bin": [ "phpunit" @@ -3228,7 +3238,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "6.5.x-dev" + "dev-master": "7.2-dev" } }, "autoload": { @@ -3254,66 +3264,7 @@ "testing", "xunit" ], - "time": "2018-04-10T11:38:34+00:00" - }, - { - "name": "phpunit/phpunit-mock-objects", - "version": "5.0.7", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "3eaf040f20154d27d6da59ca2c6e28ac8fd56dce" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/3eaf040f20154d27d6da59ca2c6e28ac8fd56dce", - "reference": "3eaf040f20154d27d6da59ca2c6e28ac8fd56dce", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.0.5", - "php": "^7.0", - "phpunit/php-text-template": "^1.2.1", - "sebastian/exporter": "^3.1" - }, - "conflict": { - "phpunit/phpunit": "<6.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.5" - }, - "suggest": { - "ext-soap": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Mock Object library for PHPUnit", - "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", - "keywords": [ - "mock", - "xunit" - ], - "time": "2018-05-29T13:50:43+00:00" + "time": "2018-06-21T13:13:39+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", @@ -3362,30 +3313,30 @@ }, { "name": "sebastian/comparator", - "version": "2.1.3", + "version": "3.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "34369daee48eafb2651bea869b4b15d75ccc35f9" + "reference": "591a30922f54656695e59b1f39501aec513403da" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/34369daee48eafb2651bea869b4b15d75ccc35f9", - "reference": "34369daee48eafb2651bea869b4b15d75ccc35f9", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/591a30922f54656695e59b1f39501aec513403da", + "reference": "591a30922f54656695e59b1f39501aec513403da", "shasum": "" }, "require": { - "php": "^7.0", - "sebastian/diff": "^2.0 || ^3.0", + "php": "^7.1", + "sebastian/diff": "^3.0", "sebastian/exporter": "^3.1" }, "require-dev": { - "phpunit/phpunit": "^6.4" + "phpunit/phpunit": "^7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.1.x-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -3422,32 +3373,33 @@ "compare", "equality" ], - "time": "2018-02-01T13:46:46+00:00" + "time": "2018-06-14T15:05:28+00:00" }, { "name": "sebastian/diff", - "version": "2.0.1", + "version": "3.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "347c1d8b49c5c3ee30c7040ea6fc446790e6bddd" + "reference": "366541b989927187c4ca70490a35615d3fef2dce" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/347c1d8b49c5c3ee30c7040ea6fc446790e6bddd", - "reference": "347c1d8b49c5c3ee30c7040ea6fc446790e6bddd", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/366541b989927187c4ca70490a35615d3fef2dce", + "reference": "366541b989927187c4ca70490a35615d3fef2dce", "shasum": "" }, "require": { - "php": "^7.0" + "php": "^7.1" }, "require-dev": { - "phpunit/phpunit": "^6.2" + "phpunit/phpunit": "^7.0", + "symfony/process": "^2 || ^3.3 || ^4" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -3472,9 +3424,12 @@ "description": "Diff implementation", "homepage": "https://github.com/sebastianbergmann/diff", "keywords": [ - "diff" + "diff", + "udiff", + "unidiff", + "unified diff" ], - "time": "2017-08-03T08:09:46+00:00" + "time": "2018-06-10T07:54:39+00:00" }, { "name": "sebastian/environment", From 6f3c8a44799dd41efad478663379aea1e88e36ae Mon Sep 17 00:00:00 2001 From: aihara005 Date: Thu, 12 Jul 2018 22:48:50 +0900 Subject: [PATCH 4/7] =?UTF-8?q?=E5=AE=9A=E6=95=B0=E3=83=95=E3=82=A1?= =?UTF-8?q?=E3=82=A4=E3=83=AB=E4=BD=9C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Repositories/Post.php | 4 +++- bootstrap/autoload.php | 35 ++++++++++++++++++++++++++++++++++ bootstrap/constants/common.php | 3 +++ public/index.php | 2 +- 4 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 bootstrap/autoload.php create mode 100644 bootstrap/constants/common.php diff --git a/app/Repositories/Post.php b/app/Repositories/Post.php index 6815e84..ce7d18e 100644 --- a/app/Repositories/Post.php +++ b/app/Repositories/Post.php @@ -14,7 +14,9 @@ public function __construct(PostModel $post_model) public function getAllPosts() { - return $this->post_model->all(); + return $this->post_model + ->where('show_flag', FLAG_ON) + ->get(); } public function getPostById(int $id) diff --git a/bootstrap/autoload.php b/bootstrap/autoload.php new file mode 100644 index 0000000..053147f --- /dev/null +++ b/bootstrap/autoload.php @@ -0,0 +1,35 @@ + Date: Thu, 12 Jul 2018 22:57:31 +0900 Subject: [PATCH 5/7] =?UTF-8?q?=E3=83=86=E3=82=B9=E3=83=88=E7=94=A8?= =?UTF-8?q?=E5=AE=9A=E6=95=B0=E3=83=95=E3=82=A1=E3=82=A4=E3=83=AB=E8=AA=AD?= =?UTF-8?q?=E3=81=BF=E8=BE=BC=E3=81=BF=E5=87=A6=E7=90=86=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/TestCase.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/TestCase.php b/tests/TestCase.php index 2932d4a..f72dcec 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -7,4 +7,23 @@ abstract class TestCase extends BaseTestCase { use CreatesApplication; + + public function setUp() + { + parent::setUp(); + $this->readConstants(); + } + + /** + * テスト用に定数ファイル読み込み + */ + private function readConstants() + { + $file_list = glob('./bootstrap/constants/*.php'); + foreach ($file_list as $file) { + if (is_file($file)) { + require_once $file; + } + } + } } From a2cf58694b7ed8eb0499f207b399204c58435626 Mon Sep 17 00:00:00 2001 From: aihara005 Date: Sat, 14 Jul 2018 23:48:51 +0900 Subject: [PATCH 6/7] =?UTF-8?q?Post=E3=82=92=E4=BD=9C=E6=88=90=E3=81=99?= =?UTF-8?q?=E3=82=8BAPI=E3=81=A8=E3=81=9D=E3=81=AE=E3=83=86=E3=82=B9?= =?UTF-8?q?=E3=83=88=E4=BD=9C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/BaseController.php | 15 ++++++++++++- app/Http/Controllers/PostController.php | 12 ++++++++++- app/Models/Post.php | 6 ++++++ app/Repositories/Post.php | 22 +++++++++++++++++++ app/Sevices/Post.php | 10 +++++++++ routes/web.php | 3 +++ tests/Feature/CreatePostsTest.php | 28 +++++++++++++++++++++++++ 7 files changed, 94 insertions(+), 2 deletions(-) create mode 100644 tests/Feature/CreatePostsTest.php diff --git a/app/Http/Controllers/BaseController.php b/app/Http/Controllers/BaseController.php index 2aba060..bafdfac 100644 --- a/app/Http/Controllers/BaseController.php +++ b/app/Http/Controllers/BaseController.php @@ -1,10 +1,23 @@ json($result, Response::HTTP_OK); + } } diff --git a/app/Http/Controllers/PostController.php b/app/Http/Controllers/PostController.php index 7f99c61..81f698b 100644 --- a/app/Http/Controllers/PostController.php +++ b/app/Http/Controllers/PostController.php @@ -25,7 +25,6 @@ public function index() return $this->post_service->getAllPosts(); } - /** * 特定IDのPostを取得 * @@ -36,4 +35,15 @@ public function show(int $id) { return $this->post_service->getPostById($id); } + + /** + * Postを作成する + * + * @param Request $request + */ + public function create(Request $request) + { + $this->post_service->createPost($request->data); + return $this->getSuccessResponse(); + } } diff --git a/app/Models/Post.php b/app/Models/Post.php index 69ece9e..e5d64bc 100644 --- a/app/Models/Post.php +++ b/app/Models/Post.php @@ -5,6 +5,12 @@ class Post extends Model { + protected $fillable = [ + 'title', + 'body', + 'show_flag' + ]; + public function comments() { return $this->hasMany(Comment::class); diff --git a/app/Repositories/Post.php b/app/Repositories/Post.php index ce7d18e..52de841 100644 --- a/app/Repositories/Post.php +++ b/app/Repositories/Post.php @@ -12,6 +12,11 @@ public function __construct(PostModel $post_model) $this->post_model = $post_model; } + /** + * フラグがonのPostをすべて取得する + * + * @return mixed + */ public function getAllPosts() { return $this->post_model @@ -19,8 +24,25 @@ public function getAllPosts() ->get(); } + /** + * 指定IDのPostを取得する + * + * @param int $id + * @return mixed + */ public function getPostById(int $id) { return $this->post_model->findOrFail($id); } + + /** + * 入力からPostを作成する + * + * @param $input + * @return mixed + */ + public function createPost($input) + { + return $this->post_model->create($input); + } } diff --git a/app/Sevices/Post.php b/app/Sevices/Post.php index 1336711..8ccbc47 100644 --- a/app/Sevices/Post.php +++ b/app/Sevices/Post.php @@ -33,4 +33,14 @@ public function getPostById(int $id) { return new PostResource($this->post_repository->getPostById($id)); } + + /** + * Postを作成 + * + * @param $input + */ + public function createPost($input) + { + return $this->post_repository->createPost($input); + } } diff --git a/routes/web.php b/routes/web.php index fec4184..e4c4c3d 100644 --- a/routes/web.php +++ b/routes/web.php @@ -10,6 +10,9 @@ | contains the "web" middleware group. Now create something great! | */ + +// post Route::get('/posts', 'PostController@index'); Route::get('/posts/{id}', 'PostController@show'); +Route::post('/posts', 'PostController@create'); diff --git a/tests/Feature/CreatePostsTest.php b/tests/Feature/CreatePostsTest.php new file mode 100644 index 0000000..54c5f82 --- /dev/null +++ b/tests/Feature/CreatePostsTest.php @@ -0,0 +1,28 @@ +json('POST', '/posts', [ + 'data' => [ + 'title' => 'title3', + 'body' => 'body333', + 'show_flag' => 1 + ] + ]); + + $response->assertStatus(200); + } +} From f18ba98ddfe54e4b0f507fafde69e8367310904e Mon Sep 17 00:00:00 2001 From: aihara005 Date: Sun, 15 Jul 2018 00:57:05 +0900 Subject: [PATCH 7/7] =?UTF-8?q?CommentPostAPI=E3=81=A8=E3=83=86=E3=82=B9?= =?UTF-8?q?=E3=83=88=E4=BD=9C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/CommentController.php | 16 +++++++++++-- app/Models/Comment.php | 5 ++++ app/Models/Post.php | 2 +- app/Repositories/Comment.php | 18 +++++++++++++++ app/Sevices/Comment.php | 18 +++++++++++++++ routes/web.php | 2 ++ tests/Feature/CreateCommentTest.php | 27 ++++++++++++++++++++++ 7 files changed, 85 insertions(+), 3 deletions(-) create mode 100644 tests/Feature/CreateCommentTest.php diff --git a/app/Http/Controllers/CommentController.php b/app/Http/Controllers/CommentController.php index 1fc34c4..0f98a9d 100644 --- a/app/Http/Controllers/CommentController.php +++ b/app/Http/Controllers/CommentController.php @@ -2,13 +2,25 @@ namespace App\Http\Controllers; +use App\Services\Comment as CommentService; use Illuminate\Http\Request; class CommentController extends BaseController { - private $comment_repository; + private $comment_service; - public function __construct() + public function __construct(CommentService $comment_service) { + $this->comment_service = $comment_service; + } + + /** + * 入力情報からCommentを作成する + * + * @param Request $request + */ + public function create(Request $request) + { + return $this->comment_service->createComment($request->data); } } diff --git a/app/Models/Comment.php b/app/Models/Comment.php index 5516958..fa08745 100644 --- a/app/Models/Comment.php +++ b/app/Models/Comment.php @@ -5,6 +5,11 @@ class Comment extends Model { + public $fillable =[ + 'post_id', + 'body' + ]; + public function post() { return $this->belongsTo(Post::class); diff --git a/app/Models/Post.php b/app/Models/Post.php index e5d64bc..6be338e 100644 --- a/app/Models/Post.php +++ b/app/Models/Post.php @@ -5,7 +5,7 @@ class Post extends Model { - protected $fillable = [ + public $fillable = [ 'title', 'body', 'show_flag' diff --git a/app/Repositories/Comment.php b/app/Repositories/Comment.php index 2290c82..cb9b5de 100644 --- a/app/Repositories/Comment.php +++ b/app/Repositories/Comment.php @@ -1,6 +1,24 @@ comment_model = $comment_model; + } + + /** + * 入力情報からCommentを作成する + * + * @param $input + */ + public function createComment($input) + { + $this->comment_model->create($input); + } } diff --git a/app/Sevices/Comment.php b/app/Sevices/Comment.php index fa208b1..ac94fa8 100644 --- a/app/Sevices/Comment.php +++ b/app/Sevices/Comment.php @@ -1,6 +1,24 @@ comment_repository = $comment_repository; + } + + /** + * 入力情報からCommentを作成する + * + * @param $input + */ + public function createComment($input) + { + $this->comment_repository->createComment($input); + } } diff --git a/routes/web.php b/routes/web.php index e4c4c3d..df1185e 100644 --- a/routes/web.php +++ b/routes/web.php @@ -16,3 +16,5 @@ Route::get('/posts/{id}', 'PostController@show'); Route::post('/posts', 'PostController@create'); +// comment +Route::post('/comments', 'CommentController@create'); diff --git a/tests/Feature/CreateCommentTest.php b/tests/Feature/CreateCommentTest.php new file mode 100644 index 0000000..8d3f64f --- /dev/null +++ b/tests/Feature/CreateCommentTest.php @@ -0,0 +1,27 @@ +json('POST', '/comments', [ + 'data' => [ + 'post_id' => 2, + 'body' => 'comment2', + ] + ]); + + $response->assertStatus(200); + } +}