ImboIntegrationTest\Auth\AccessControl\Adapter\AdapterTests::testCanAddAndFetchGroups PHP Method

testCanAddAndFetchGroups() public method

    public function testCanAddAndFetchGroups()
    {
        $this->assertFalse($this->adapter->getGroup('g1'));
        $this->assertFalse($this->adapter->getGroup('g2'));
        $this->adapter->addResourceGroup('g1', ['images.get', 'images.head']);
        $this->adapter->addResourceGroup('g2', ['status.get']);
        $this->assertSame(['images.get', 'images.head'], $this->adapter->getGroup('g1'));
        $this->assertSame(['status.get'], $this->adapter->getGroup('g2'));
        $model = $this->getMock('Imbo\\Model\\Groups');
        $model->expects($this->once())->method('setHits')->with(2);
        $groups = $this->adapter->getGroups(null, $model);
        $this->assertArrayHasKey('g1', $groups);
        $this->assertArrayHasKey('g2', $groups);
        $this->assertSame(['images.get', 'images.head'], $groups['g1']);
        $this->assertSame(['status.get'], $groups['g2']);
    }