Skip to content

Commit 7f2e2b3

Browse files
committed
test: Fixed tests
1 parent f59edbb commit 7f2e2b3

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

tests/DiscussionTest.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function frontpage(array $filters = []): Collection
3131
public function filter(): void
3232
{
3333
$this->frontpage([
34-
'tag' => env('DISCUSSION_TAG_FILTER', 'general')
34+
'tags' => env('DISCUSSION_TAG_FILTER', 'general')
3535
]);
3636
}
3737

@@ -59,7 +59,9 @@ public function discussion(Collection $collection): Item
5959
self::assertNotNull($discussion->title);
6060
self::assertNotNull($discussion->slug);
6161

62-
self::assertNotNull($discussion->tags, 'The relation tags should be set on a discussion.');
62+
if (array_key_exists('tags', $discussion->relationships)) {
63+
self::assertNotNull($discussion->tags, 'The relation tags should be set on a discussion.');
64+
}
6365

6466
self::assertNotNull($discussion->firstPost, 'A discussion has a start post.');
6567

tests/TokenTest.php

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,26 @@ class TokenTest extends TestCase
1414
*/
1515
public function tokenTest(): Token
1616
{
17+
if (!env('FLARUM_USERNAME') || !env('FLARUM_PASSWORD')) {
18+
self::markTestSkipped('No credentials provided.');
19+
}
20+
21+
if (!env('FLARUM_API_KEY')) {
22+
// Remove strictness
23+
$this->client->setStrict(false);
24+
}
25+
1726
$request = $this->client->token()->post([
1827
'identification' => env('FLARUM_USERNAME'),
19-
'password' => env('FLARUM_PASSWORD')
28+
'password' => env('FLARUM_PASSWORD'),
29+
'bypassCsrfToken' => true
2030
]);
2131
$token = $request->request();
22-
32+
2333
self::assertInstanceOf(Token::class, $token);
2434
self::assertIsInt($token->userId);
2535
self::assertIsString($token->token);
26-
36+
2737
return $token;
2838
}
2939
}

0 commit comments

Comments
 (0)