mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-11-24 03:42:32 +01:00
Updated existing tag tests away from browserkit testing
This commit is contained in:
parent
3eaf03a7ac
commit
fb5b5e138d
@ -35,12 +35,12 @@ class TagTest extends TestCase
|
|||||||
$attrs = $attrs->merge(factory(Tag::class, 5)->make(['name' => 'county']));
|
$attrs = $attrs->merge(factory(Tag::class, 5)->make(['name' => 'county']));
|
||||||
$attrs = $attrs->merge(factory(Tag::class, 5)->make(['name' => 'planet']));
|
$attrs = $attrs->merge(factory(Tag::class, 5)->make(['name' => 'planet']));
|
||||||
$attrs = $attrs->merge(factory(Tag::class, 5)->make(['name' => 'plans']));
|
$attrs = $attrs->merge(factory(Tag::class, 5)->make(['name' => 'plans']));
|
||||||
$page = $this->getEntityWithTags(Page::class, $attrs);
|
$page = $this->getEntityWithTags(Page::class, $attrs->all());
|
||||||
|
|
||||||
$this->asAdmin()->get('/ajax/tags/suggest/names?search=dog')->seeJsonEquals([]);
|
$this->asAdmin()->get('/ajax/tags/suggest/names?search=dog')->assertExactJson([]);
|
||||||
$this->get('/ajax/tags/suggest/names?search=co')->seeJsonEquals(['color', 'country', 'county']);
|
$this->get('/ajax/tags/suggest/names?search=co')->assertExactJson(['color', 'country', 'county']);
|
||||||
$this->get('/ajax/tags/suggest/names?search=cou')->seeJsonEquals(['country', 'county']);
|
$this->get('/ajax/tags/suggest/names?search=cou')->assertExactJson(['country', 'county']);
|
||||||
$this->get('/ajax/tags/suggest/names?search=pla')->seeJsonEquals(['planet', 'plans']);
|
$this->get('/ajax/tags/suggest/names?search=pla')->assertExactJson(['planet', 'plans']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_tag_value_suggestions()
|
public function test_tag_value_suggestions()
|
||||||
@ -53,12 +53,12 @@ class TagTest extends TestCase
|
|||||||
$attrs = $attrs->merge(factory(Tag::class, 5)->make(['name' => 'county', 'value' => 'dog']));
|
$attrs = $attrs->merge(factory(Tag::class, 5)->make(['name' => 'county', 'value' => 'dog']));
|
||||||
$attrs = $attrs->merge(factory(Tag::class, 5)->make(['name' => 'planet', 'value' => 'catapult']));
|
$attrs = $attrs->merge(factory(Tag::class, 5)->make(['name' => 'planet', 'value' => 'catapult']));
|
||||||
$attrs = $attrs->merge(factory(Tag::class, 5)->make(['name' => 'plans', 'value' => 'dodgy']));
|
$attrs = $attrs->merge(factory(Tag::class, 5)->make(['name' => 'plans', 'value' => 'dodgy']));
|
||||||
$page = $this->getEntityWithTags(Page::class, $attrs);
|
$page = $this->getEntityWithTags(Page::class, $attrs->all());
|
||||||
|
|
||||||
$this->asAdmin()->get('/ajax/tags/suggest/values?search=ora')->seeJsonEquals([]);
|
$this->asAdmin()->get('/ajax/tags/suggest/values?search=ora')->assertExactJson([]);
|
||||||
$this->get('/ajax/tags/suggest/values?search=cat')->seeJsonEquals(['cats', 'cattery', 'catapult']);
|
$this->get('/ajax/tags/suggest/values?search=cat')->assertExactJson(['cats', 'cattery', 'catapult']);
|
||||||
$this->get('/ajax/tags/suggest/values?search=do')->seeJsonEquals(['dog', 'dodgy']);
|
$this->get('/ajax/tags/suggest/values?search=do')->assertExactJson(['dog', 'dodgy']);
|
||||||
$this->get('/ajax/tags/suggest/values?search=cas')->seeJsonEquals(['castle']);
|
$this->get('/ajax/tags/suggest/values?search=cas')->assertExactJson(['castle']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_entity_permissions_effect_tag_suggestions()
|
public function test_entity_permissions_effect_tag_suggestions()
|
||||||
@ -67,18 +67,18 @@ class TagTest extends TestCase
|
|||||||
$attrs = collect();
|
$attrs = collect();
|
||||||
$attrs = $attrs->merge(factory(Tag::class, 5)->make(['name' => 'country']));
|
$attrs = $attrs->merge(factory(Tag::class, 5)->make(['name' => 'country']));
|
||||||
$attrs = $attrs->merge(factory(Tag::class, 5)->make(['name' => 'color']));
|
$attrs = $attrs->merge(factory(Tag::class, 5)->make(['name' => 'color']));
|
||||||
$page = $this->getEntityWithTags(Page::class, $attrs);
|
$page = $this->getEntityWithTags(Page::class, $attrs->all());
|
||||||
|
|
||||||
$this->asAdmin()->get('/ajax/tags/suggest/names?search=co')->seeJsonEquals(['color', 'country']);
|
$this->asAdmin()->get('/ajax/tags/suggest/names?search=co')->assertExactJson(['color', 'country']);
|
||||||
$this->asEditor()->get('/ajax/tags/suggest/names?search=co')->seeJsonEquals(['color', 'country']);
|
$this->asEditor()->get('/ajax/tags/suggest/names?search=co')->assertExactJson(['color', 'country']);
|
||||||
|
|
||||||
// Set restricted permission the page
|
// Set restricted permission the page
|
||||||
$page->restricted = true;
|
$page->restricted = true;
|
||||||
$page->save();
|
$page->save();
|
||||||
$page->rebuildPermissions();
|
$page->rebuildPermissions();
|
||||||
|
|
||||||
$this->asAdmin()->get('/ajax/tags/suggest/names?search=co')->seeJsonEquals(['color', 'country']);
|
$this->asAdmin()->get('/ajax/tags/suggest/names?search=co')->assertExactJson(['color', 'country']);
|
||||||
$this->asEditor()->get('/ajax/tags/suggest/names?search=co')->seeJsonEquals([]);
|
$this->asEditor()->get('/ajax/tags/suggest/names?search=co')->assertExactJson([]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_tags_shown_on_search_listing()
|
public function test_tags_shown_on_search_listing()
|
||||||
|
Loading…
Reference in New Issue
Block a user