Jarves\Tests\Configuration\EventTest::testClearCache PHP Method

testClearCache() public method

public testClearCache ( )
    public function testClearCache()
    {
        $xml = '<event key="core/cache" subject="foo">
  <clearCache>core/test1</clearCache>
  <clearCache>core/test2</clearCache>
</event>';
        $event = new Event($xml, $this->getJarves());
        $this->getJarvesEventDispatcher()->detachEvents();
        $this->getJarvesEventDispatcher()->attachEvent($event);
        $this->getCacher()->setDistributedCache('core/test1', 'test1');
        $this->getCacher()->setDistributedCache('core/test2', 'test2');
        $this->getCacher()->setDistributedCache('core/test2/sub', 'sub');
        $this->assertEquals('test1', $this->getCacher()->getDistributedCache('core/test1'));
        $this->assertEquals('test2', $this->getCacher()->getDistributedCache('core/test2'));
        $this->assertEquals('sub', $this->getCacher()->getDistributedCache('core/test2/sub'));
        $this->getEventDispatcher()->dispatch('core/cache', new GenericEvent());
        $this->assertEquals('test1', $this->getCacher()->getDistributedCache('core/test1'));
        $this->assertEquals('test2', $this->getCacher()->getDistributedCache('core/test2'));
        $this->assertEquals('sub', $this->getCacher()->getDistributedCache('core/test2/sub'));
        $this->getEventDispatcher()->dispatch('core/cache', new GenericEvent('foo'));
        $this->assertNull($this->getCacher()->getDistributedCache('core/test1'));
        $this->assertNull($this->getCacher()->getDistributedCache('core/test2'));
        $this->assertNull($this->getCacher()->getDistributedCache('core/test2/sub'));
        $this->getJarvesEventDispatcher()->detachEvents();
    }