for(Location::factory())->create(); $response = $this->actingAs(User::factory()->admin()->create()) ->postJson(route('admin.nodes.view.configuration.token', ['node' => $node])); $response->assertOk(); $response->assertJsonPath('node', $node->id); $key = ApiKey::query() ->where('identifier', substr($response->json('token'), 0, ApiKey::IDENTIFIER_LENGTH)) ->firstOrFail(); $this->assertSame(AdminAcl::READ | AdminAcl::WRITE, $key->r_nodes); } }