mirror of
https://github.com/CachetHQ/Cachet.git
synced 2025-01-17 13:38:20 +01:00
Add tests for tags
This commit is contained in:
parent
3807a6b3bb
commit
d9e27b5f46
@ -37,6 +37,19 @@ class ComponentTest extends AbstractApiTestCase
|
|||||||
$response->assertJsonFragment(['id' => $components[2]->id]);
|
$response->assertJsonFragment(['id' => $components[2]->id]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function test_can_get_all_components_with_tags()
|
||||||
|
{
|
||||||
|
$components = factory(Component::class, 2)->create();
|
||||||
|
$components[0]->attachTags(["Hello World"]);
|
||||||
|
$components[1]->attachTags(["Foo", "Bar"]);
|
||||||
|
|
||||||
|
$response = $this->json('GET', '/api/v1/components', ['tags' => ['foo']]);
|
||||||
|
|
||||||
|
$response->assertStatus(200);
|
||||||
|
$response->assertJsonMissing(['id' => $components[0]->id]);
|
||||||
|
$response->assertJsonFragment(['id' => $components[1]->id]);
|
||||||
|
}
|
||||||
|
|
||||||
public function test_cannot_get_invalid_component()
|
public function test_cannot_get_invalid_component()
|
||||||
{
|
{
|
||||||
$response = $this->json('GET', '/api/v1/components/1');
|
$response = $this->json('GET', '/api/v1/components/1');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user