diff --git a/tests/Controller/Profile/ListProfileContentsTest.php b/tests/Controller/Profile/ListProfileContentsTest.php deleted file mode 100644 index 8c9a945..0000000 --- a/tests/Controller/Profile/ListProfileContentsTest.php +++ /dev/null @@ -1,94 +0,0 @@ -object(); - $profile = ProfileFactory::createOne(['user' => $user]); - ContentFactory::createMany(2, ['profile' => $profile]); - - ContentFactory::assert()->count(2); - - $this->client->loginUser($user); - - // Act - $this->jsonGet( - uri: "/api/profiles/{$profile->getId()}/contents", - ); - - // Assert - self::assertResponseStatusCodeSame(Response::HTTP_OK); - $json = $this->jsonResponseContent(); - self::assertCount(2, $json); - } - - public function testOnlyReturnContentsOfProfileSpecified(): void - { - // Arrange & pre-assert - $user = UserFactory::createOne()->object(); - $profileA = ProfileFactory::createOne(['user' => $user]); - $profileB = ProfileFactory::createOne(['user' => $user]); - ContentFactory::createMany(2, ['profile' => $profileA]); - ContentFactory::createMany(2, ['profile' => $profileB]); - - ContentFactory::assert()->count(4); - - $this->client->loginUser($user); - - // Act - $this->jsonGet( - uri: "/api/profiles/{$profileA->getId()}/contents", - ); - - // Assert - self::assertResponseStatusCodeSame(Response::HTTP_OK); - $json = $this->jsonResponseContent(); - self::assertCount(2, $json); - } - - public function testCannotListContentsOfProfileUserDontOwn(): void - { - // Arrange & pre-assert - $profile = ProfileFactory::createOne(['user' => UserFactory::createOne()]); - $notTheOwner = UserFactory::createOne()->object(); - ContentFactory::createMany(2, ['profile' => $profile]); - - ProfileFactory::assert()->count(2); - - $this->client->loginUser($notTheOwner); - - $this->expectException(AccessDeniedException::class); - - // Act - $this->jsonGet( - uri: "/api/profiles/{$profile->getId()}/contents", - ); - } - - public function testCannotListContentsOfProfileWhenGuest(): void - { - // Arrange & pre-assert - $profile = ProfileFactory::createOne(['user' => UserFactory::createOne()]); - - $this->expectException(AccessDeniedException::class); - - // Act - $this->jsonGet( - uri: "/api/profiles/{$profile->getId()}/contents", - ); - } -} diff --git a/tests/Controller/Auth/LoginTest.php b/tests/Feature/Auth/LoginTest.php similarity index 91% rename from tests/Controller/Auth/LoginTest.php rename to tests/Feature/Auth/LoginTest.php index cee60d6..f410408 100644 --- a/tests/Controller/Auth/LoginTest.php +++ b/tests/Feature/Auth/LoginTest.php @@ -1,6 +1,6 @@