appwrite/tests/e2e/Services/Advisor/AdvisorCustomServerTest.php
copilot-swe-agent[bot] bfd6cebbb0
fix(advisor): address review comments on tests, naming, docs, and get insight
Agent-Logs-Url: https://github.com/appwrite/appwrite/sessions/517a4586-d3e8-40b3-a3a9-f2d2ca82b0a0

Co-authored-by: abnegate <5857008+abnegate@users.noreply.github.com>
2026-05-11 01:59:31 +00:00

57 lines
1.4 KiB
PHP

<?php
namespace Tests\E2E\Services\Advisor;
use Tests\E2E\Client;
use Tests\E2E\Scopes\ProjectCustom;
use Tests\E2E\Scopes\Scope;
use Tests\E2E\Scopes\SideServer;
use Utopia\Database\Helpers\ID;
class AdvisorCustomServerTest extends Scope
{
use AdvisorBase;
use ProjectCustom;
use SideServer;
public function testReadWithAdvisorScopes(): void
{
$projectId = $this->getProject()['$id'];
$userKey = $this->getNewKey([
'insights.read',
'reports.read',
]);
$listed = $this->client->call(
Client::METHOD_GET,
'/reports',
[
'content-type' => 'application/json',
'x-appwrite-project' => $projectId,
'x-appwrite-key' => $userKey,
]
);
$this->assertSame(200, $listed['headers']['status-code']);
$create = $this->client->call(
Client::METHOD_POST,
'/reports',
[
'content-type' => 'application/json',
'x-appwrite-project' => $projectId,
'x-appwrite-key' => $userKey,
],
[
'reportId' => ID::unique(),
'type' => 'audit',
'title' => 'Read-only check',
'targetType' => 'sites',
'target' => 'home',
]
);
$this->assertSame(404, $create['headers']['status-code']);
}
}