prepareDatabase([ 'users' => [ $this->normalUser(), ] ]); } /** * @test */ public function normal_user_sees_most_information() { $response = $this->send( $this->request('GET', '/api', [ 'authenticatedAs' => 2, ]) ); $this->assertEquals(200, $response->getStatusCode()); $json = json_decode($response->getBody()->getContents(), true); $this->assertEquals(true, Arr::get($json, 'data.attributes.debug')); $this->assertEquals('http://localhost', Arr::get($json, 'data.attributes.baseUrl')); $this->assertEquals('http://localhost/api', Arr::get($json, 'data.attributes.apiUrl')); $this->assertArrayNotHasKey('adminUrl', Arr::get($json, 'data.attributes')); } /** * @test */ public function admin_user_sees_even_more() { $response = $this->send( $this->request('GET', '/api', [ 'authenticatedAs' => 1, ]) ); $this->assertEquals(200, $response->getStatusCode()); $json = json_decode($response->getBody()->getContents(), true); $this->assertEquals(true, Arr::get($json, 'data.attributes.debug')); $this->assertEquals('http://localhost', Arr::get($json, 'data.attributes.baseUrl')); $this->assertEquals('http://localhost/api', Arr::get($json, 'data.attributes.apiUrl')); $this->assertEquals('http://localhost/admin', Arr::get($json, 'data.attributes.adminUrl')); } }