Phalcon\Test\Unit\Acl\Adapter\MemoryTest::testWildCardLastRole PHP Method

testWildCardLastRole() public method

Tests acl with adding new rule for role after adding wildcard rule
Since: 2016-10-01
Author: Wojciech Slawski ([email protected])
    public function testWildCardLastRole()
    {
        $this->specify("Cant add acl rule to existing role after adding wildcard rule", function () {
            $acl = new Memory();
            $acl->addRole(new Role("Guests"));
            $acl->addResource(new Resource('Post'), ['index', 'update', 'create']);
            $acl->allow('Guests', 'Post', 'create');
            $acl->allow('*', 'Post', 'index');
            $acl->allow('Guests', 'Post', 'update');
            expect($acl->isAllowed('Guests', 'Post', 'create'))->true();
            expect($acl->isAllowed('Guests', 'Post', 'index'))->true();
            expect($acl->isAllowed('Guests', 'Post', 'update'))->true();
        });
    }