public function testClearCache()
{
$this->allowLogin($this->getApp());
$cache = $this->getMockCache();
$cache->expects($this->at(0))->method('flushAll')->will($this->returnValue(false));
$cache->expects($this->at(1))->method('flushAll')->will($this->returnValue(true));
$this->setService('cache', $cache);
$this->setRequest(Request::create('/bolt/clearcache'));
$this->checkTwigForTemplate($this->getApp(), '@bolt/clearcache/clearcache.twig');
$this->controller()->clearCache();
$this->assertNotEmpty($this->getFlashBag()->get('error'));
$this->setRequest(Request::create('/bolt/clearcache'));
$this->checkTwigForTemplate($this->getApp(), '@bolt/clearcache/clearcache.twig');
$this->controller()->clearCache();
$this->assertNotEmpty($this->getFlashBag()->get('success'));
}