Skip to content

Commit 45c2924

Browse files
add expectExceptionCode for all tests that check for exceptions to ensure that http status codes are being passed
1 parent da70be2 commit 45c2924

File tree

6 files changed

+9
-0
lines changed

6 files changed

+9
-0
lines changed

tests/EndpointBlocksTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ public function it_throws_a_notion_exception_bad_request()
4545

4646
$this->expectException(NotionException::class);
4747
$this->expectExceptionMessage('Bad Request');
48+
$this->expectExceptionCode(400);
4849

4950
Notion::block('b55c9c91-384d-452b-81db-d1ef79372b76')->children();
5051
}
@@ -216,6 +217,7 @@ public function it_throws_a_notion_exception_not_found()
216217

217218
$this->expectException(NotionException::class);
218219
$this->expectExceptionMessage('Not found');
220+
$this->expectExceptionCode(404);
219221

220222
Notion::block('b55c9c91-384d-452b-81db-d1ef79372b11')->children();
221223
}

tests/EndpointDatabaseTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ public function it_throws_a_notion_exception_bad_request()
155155

156156
$this->expectException(NotionException::class);
157157
$this->expectExceptionMessage('Bad Request');
158+
$this->expectExceptionCode(400);
158159

159160
Notion::database('8284f3ff77e24d4a939d19459e4d6bdc')->query();
160161
}

tests/EndpointPagesTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ public function it_throws_a_notion_exception_bad_request()
4646

4747
$this->expectException(NotionException::class);
4848
$this->expectExceptionMessage('Bad Request');
49+
$this->expectExceptionCode(400);
4950

5051
Notion::pages()->find('afd5f6fb-1cbd-41d1-a108-a22ae0d9bac8');
5152
}
@@ -95,6 +96,7 @@ public function it_throws_a_notion_exception_not_found()
9596

9697
$this->expectException(NotionException::class);
9798
$this->expectExceptionMessage('Not found');
99+
$this->expectExceptionCode(404);
98100

99101
Notion::pages()->find('b55c9c91-384d-452b-81db-d1ef79372b79');
100102
}

tests/EndpointSearchTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public function it_throws_a_notion_exception_bad_request()
3232

3333
$this->expectException(NotionException::class);
3434
$this->expectExceptionMessage('Bad Request');
35+
$this->expectExceptionCode(400);
3536

3637
Notion::search()->query();
3738
}

tests/EndpointUsersTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public function it_throws_a_notion_exception_bad_request()
3131

3232
$this->expectException(NotionException::class);
3333
$this->expectExceptionMessage('Bad Request');
34+
$this->expectExceptionCode(400);
3435

3536
Notion::users()->all();
3637
}
@@ -96,6 +97,7 @@ public function it_throws_a_notion_exception_not_found()
9697

9798
$this->expectException(NotionException::class);
9899
$this->expectExceptionMessage('Not found');
100+
$this->expectExceptionCode(404);
99101

100102
Notion::users()->find('d40e767c-d7af-4b18-a86d-55c61f1e39a1');
101103
}

tests/NotionExceptionTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ public function it_throws_a_notion_exception_with_detailed_message_from_response
2323

2424
$this->expectException(NotionException::class);
2525
$this->expectExceptionMessage('Bad Request: (validation_error) (path failed validation: path.id should be a valid uuid, instead was');
26+
$this->expectExceptionCode(400);
2627

2728
\Notion::block('d092140ce4e549bf9915fb8ad43d1699d')->children()->asCollection();
2829
}

0 commit comments

Comments
 (0)