Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
dbp-relay-base-person-bundle
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
digital blueprint
Relay API Gateway
dbp-relay-base-person-bundle
Commits
b402c3c4
Commit
b402c3c4
authored
3 years ago
by
Reiter, Christoph
Browse files
Options
Downloads
Patches
Plain Diff
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
3 years ago
Stage: test
Changes
2
Pipelines
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/Entity/Person.php
+3
-2
3 additions, 2 deletions
src/Entity/Person.php
tests/ExtTest.php
+8
-8
8 additions, 8 deletions
tests/ExtTest.php
with
11 additions
and
10 deletions
src/Entity/Person.php
+
3
−
2
View file @
b402c3c4
...
...
@@ -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"},
...
...
This diff is collapsed.
Click to expand it.
tests/ExtTest.php
+
8
−
8
View file @
b402c3c4
...
...
@@ -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
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment