Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
27pchrisl committed Apr 6, 2021
1 parent debbdc5 commit dc16406
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 0 deletions.
27 changes: 27 additions & 0 deletions tests/Unit/Queries/Entity/EntityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,33 @@ public function test_read_an_entity_etag()
);
}

public function test_read_an_entity_if_match()
{
$this->assertMetadataResponse(
Request::factory()
->header('if-match', 'W/"9002879996637791044635c0a75ae412322098677c04322be3da15089239bc76"')
->path('/flights(1)')
);
}

public function test_read_an_entity_if_match_failed()
{
$this->assertPreconditionFailed(
Request::factory()
->header('if-match', 'xxx')
->path('/flights(1)')
);
}

public function test_read_an_entity_if_match_any()
{
$this->assertMetadataResponse(
Request::factory()
->header('if-match', '*')
->path('/flights(1)')
);
}

public function test_read_an_entity_with_full_metadata()
{
$this->assertJsonResponse(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
headers:
cache-control: ['no-cache, private']
content-type: [application/json]
odata-version: ['4.01']
etag: ['W/"9002879996637791044635c0a75ae412322098677c04322be3da15089239bc76"']
status: 200
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
headers:
cache-control: ['no-cache, private']
content-type: [application/json]
odata-version: ['4.01']
etag: ['W/"9002879996637791044635c0a75ae412322098677c04322be3da15089239bc76"']
status: 200
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"code": "etag_mismatch",
"message": "The provided If-Match header did not match the current ETag value"
}

0 comments on commit dc16406

Please sign in to comment.