Пример #1
0
 /**
  * Verify that contents can be compressed using gzip.
  */
 public function testSetAPathUsingGzipCompression()
 {
     $this->manager->setCompression(Database::GZIP);
     $this->manager->setPath($this->values['path'], new Memory($this->values['contents'], $this->values['type'], $this->values['modified'], $this->values['permissions']));
     $query = $this->pdo->query("SELECT * FROM paths WHERE path = '{$this->values['path']}'");
     $records = $query->fetchAll();
     $query->closeCursor();
     self::assertEquals(array_merge($this->values, ['compression' => Database::GZIP, 'contents' => gzencode($this->values['contents'])]), $records[0], 'The contents were not compressed using gzip.');
     $path = $this->manager->getPath($this->values['path']);
     self::assertEquals($this->values['contents'], $path->getContents(), 'The contents were not decompressed after selection.');
 }
Пример #2
0
Файл: Sqon.php Проект: sqon/sqon
 /**
  * {@inheritdoc}
  */
 public function setPath($path, PathInterface $manager)
 {
     $event = $this->dispatch(BeforeSetPathEvent::NAME, BeforeSetPathEvent::class, function (BeforeSetPathEvent $event) use(&$path, &$manager) {
         $manager = $event->getManager();
         $path = $event->getPath();
     }, $path, $manager);
     if (null !== $event && $event->isSkipped()) {
         return $this;
     }
     $this->database->setPath($this->cleanPath($path), $manager);
     $this->dispatch(AfterSetPathEvent::NAME, AfterSetPathEvent::class, null, $path, $manager);
     return $this;
 }