Entity\TagTests::test_entity_permissions_effect_tag_suggestions PHP Method

test_entity_permissions_effect_tag_suggestions() public method

    public function test_entity_permissions_effect_tag_suggestions()
    {
        $permissionService = $this->app->make(PermissionService::class);
        // Create some tags with similar names to test with and save to a page
        $attrs = collect();
        $attrs = $attrs->merge(factory(Tag::class, 5)->make(['name' => 'country']));
        $attrs = $attrs->merge(factory(Tag::class, 5)->make(['name' => 'color']));
        $page = $this->getPageWithTags($attrs);
        $this->asAdmin()->get('/ajax/tags/suggest?search=co')->seeJsonEquals(['color', 'country']);
        $this->asEditor()->get('/ajax/tags/suggest?search=co')->seeJsonEquals(['color', 'country']);
        // Set restricted permission the page
        $page->restricted = true;
        $page->save();
        $permissionService->buildJointPermissionsForEntity($page);
        $this->asAdmin()->get('/ajax/tags/suggest?search=co')->seeJsonEquals(['color', 'country']);
        $this->asEditor()->get('/ajax/tags/suggest?search=co')->seeJsonEquals([]);
    }