From 3bdbb5ed9b2bfa7147076f6fe86c261fd8ba6086 Mon Sep 17 00:00:00 2001 From: Gabriel do Carmo Vieira Date: Sun, 18 Aug 2024 00:46:31 -0300 Subject: [PATCH] fix: temporary fix with third party call api --- .../V1/AuthenticatedUserControllerTest.php | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/tests/Feature/Http/Controllers/Api/V1/AuthenticatedUserControllerTest.php b/tests/Feature/Http/Controllers/Api/V1/AuthenticatedUserControllerTest.php index bf989c5..3432388 100644 --- a/tests/Feature/Http/Controllers/Api/V1/AuthenticatedUserControllerTest.php +++ b/tests/Feature/Http/Controllers/Api/V1/AuthenticatedUserControllerTest.php @@ -2,13 +2,14 @@ namespace Tests\Feature\Http\Controllers\Api\V1; +use App\Clients\Consumer\ConsumerClient; use App\Models\User; -use Illuminate\Foundation\Testing\DatabaseMigrations; +use Illuminate\Foundation\Testing\RefreshDatabase; use Tests\TestCase; class AuthenticatedUserControllerTest extends TestCase { - use DatabaseMigrations; + use RefreshDatabase; protected function setUp(): void { @@ -19,8 +20,19 @@ public function testPutSettings() { // Arrange $this->artisan('db:seed'); - $user = User::factory() - ->create(); + $user = User::factory()->create(); + + /** + * I don't think the right way would be to run a docker compose with + * the Rust + ScyllaDB (and also Postgres, Redis) just to run the tests, + * at the same time I'm not a php dev, so there may well be a better solution for this. + */ + $this->partialMock(ConsumerClient::class, function ($mock) use ($user) { + $mock->shouldReceive('updateUser') + ->once() + ->with($user) + ->andReturn(true); + }); $user->accounts()->create([ 'provider' => 'twitch',