Skip to content
Snippets Groups Projects
Commit b402c3c4 authored by Reiter, Christoph's avatar Reiter, Christoph :snake:
Browse files

Move to new base resource naming

prefix path with /base and shortName as well
parent 11711281
No related branches found
No related tags found
No related merge requests found
Pipeline #58761 passed
......@@ -10,7 +10,7 @@ use ApiPlatform\Core\Annotation\ApiResource;
* @ApiResource(
* collectionOperations={
* "get" = {
* "path" = "/people",
* "path" = "/base/people",
* "openapi_context" = {
* "tags" = {"BasePerson"},
* "parameters" = {
......@@ -21,7 +21,7 @@ use ApiPlatform\Core\Annotation\ApiResource;
* },
* itemOperations={
* "get" = {
* "path" = "/people/{identifier}",
* "path" = "/base/people/{identifier}",
* "openapi_context" = {
* "tags" = {"BasePerson"},
* }
......@@ -29,6 +29,7 @@ use ApiPlatform\Core\Annotation\ApiResource;
* },
* },
* iri="http://schema.org/Person",
* shortName="BasePerson",
* description="A person of the LDAP system",
* normalizationContext={
* "groups" = {"BasePerson:output"},
......
......@@ -31,14 +31,14 @@ class ExtTest extends ApiTestCase
public function testGetPersonNoAuth()
{
$client = $this->withUser('foobar', ['foo']);
$response = $client->request('GET', '/people/foobar');
$response = $client->request('GET', '/base/people/foobar');
$this->assertEquals(Response::HTTP_UNAUTHORIZED, $response->getStatusCode());
}
public function testGetPersonWrongAuth()
{
$client = $this->withUser('foobar', [], '42');
$response = $client->request('GET', '/people/foobar', ['headers' => [
$response = $client->request('GET', '/base/people/foobar', ['headers' => [
'Authorization' => 'Bearer NOT42',
]]);
$this->assertEquals(Response::HTTP_FORBIDDEN, $response->getStatusCode());
......@@ -50,12 +50,12 @@ class ExtTest extends ApiTestCase
$user = $this->getUser($client);
$person = $this->withPerson($client, $user);
$person->setEmail('foo@bar.com');
$response = $client->request('GET', '/people/foobar', ['headers' => [
$response = $client->request('GET', '/base/people/foobar', ['headers' => [
'Authorization' => 'Bearer 42',
]]);
$this->assertJson($response->getContent(false));
$data = json_decode($response->getContent(false), true, 512, JSON_THROW_ON_ERROR);
$this->assertEquals('/people/foobar', $data['@id']);
$this->assertEquals('/base/people/foobar', $data['@id']);
$this->assertEquals('foobar', $data['identifier']);
$this->assertEquals('foo@bar.com', $data['email']);
}
......@@ -63,7 +63,7 @@ class ExtTest extends ApiTestCase
public function testResponseHeaders()
{
$client = $this->withUser('foobar', [], '42');
$response = $client->request('GET', '/people/foobar', ['headers' => [
$response = $client->request('GET', '/base/people/foobar', ['headers' => [
'Authorization' => 'Bearer 42',
]]);
$header = $response->getHeaders();
......@@ -84,7 +84,7 @@ class ExtTest extends ApiTestCase
$client = $this->withUser('foobar', ['ROLE'], '42');
$user = $this->getUser($client);
$this->withPerson($client, $user);
$response = $client->request('GET', '/people/foobar', ['headers' => [
$response = $client->request('GET', '/base/people/foobar', ['headers' => [
'Authorization' => 'Bearer 42',
]]);
$data = json_decode($response->getContent(), true, 512, JSON_THROW_ON_ERROR);
......@@ -96,8 +96,8 @@ class ExtTest extends ApiTestCase
$client = self::createClient();
$endpoints = [
'/people',
'/people/foo',
'/base/people',
'/base/people/foo',
];
foreach ($endpoints as $path) {
$response = $client->request('GET', $path);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment