Exemplo n.º 1
0
 /**
  * @covers \Core\Cache\FileCache::destroy
  */
 public function testCacheDestroy()
 {
     $this->assertInternalType('array', Cache::destroy());
     /* Check if Cache Directory is empty */
     $this->assertEquals(count(scandir(vfsStream::url('root/cache'))), 2);
 }
 /**
  * Generate new csrf token
  *
  * @return string
  */
 protected function generateToken()
 {
     $this->token = md5(uniqid(microtime(), true));
     if (session_status() === PHP_SESSION_NONE) {
         $t = Cache::put('csrf-token', $this->token, 2000);
         $r = Cache::get('csrf-token');
     } else {
         $_SESSION['csrf-token'] = $this->token;
     }
     $this->setCsrfInView($this->token);
     return $this->token;
 }