user = User::factory()->create(); $this->admin = User::factory()->administrator()->create(); } /** * @test */ public function test_infos_returns_unauthorized() { $response = $this->json('GET', '/infos') ->assertUnauthorized(); } /** * @test */ public function test_infos_returns_forbidden() { $response = $this->actingAs($this->user, 'api-guard') ->json('GET', '/infos') ->assertForbidden(); } /** * @test */ public function test_infos_returns_only_base_collection() { $response = $this->actingAs($this->admin, 'api-guard') ->json('GET', '/infos') ->assertOk() ->assertJsonStructure([ 'common' => [ 'Date', 'userAgent', 'Version', 'Environment', 'Install path', 'Debug', 'Cache driver', 'Log channel', 'Log level', 'DB driver', 'PHP version', 'Operating system', 'interface', 'Auth guard', 'webauthn user verification', 'Trusted proxies', 'lastRadarScan' ], ]); } /** * @test */ public function test_infos_returns_proxy_collection_when_signed_in_behind_proxy() { $response = $this->actingAs($this->admin, 'reverse-proxy-guard') ->json('GET', '/infos') ->assertOk() ->assertJsonStructure([ 'common' => [ 'Auth proxy logout url', 'Auth proxy header for user', 'Auth proxy header for email', ], ]); } /** * @test */ public function test_latestrelease_runs_manual_scan() { $releaseRadarService = $this->mock(ReleaseRadarService::class)->makePartial(); $releaseRadarService->shouldReceive('manualScan') ->once() ->andReturn('new_release'); $response = $this->json('GET', '/latestRelease') ->assertOk() ->assertJson([ 'newRelease' => 'new_release', ]); } }