Esempio n. 1
0
 public function testGetters()
 {
     $this->config['allowed_extensions'] = ['jpg', 'png'];
     $this->autoThumb->setConfig($this->config);
     $this->assertEquals($this->config['allowed_extensions'], $this->autoThumb->getAllowedExtensions());
     $this->assertInstanceOf('\\ysaroka\\autothumb\\Thumbnailer', $this->autoThumb->getThumbnailer());
     $this->assertEquals(realpath($this->config['document_root']), $this->autoThumb->getDocumentRoot());
     $this->assertTrue(array_key_exists('small', $this->autoThumb->getTypes()) && array_key_exists('medium', $this->autoThumb->getTypes()) && array_key_exists('large', $this->autoThumb->getTypes()) && array_key_exists('50x50', $this->autoThumb->getTypes()) && array_key_exists('100x200', $this->autoThumb->getTypes()) && array_key_exists('empty', $this->autoThumb->getTypes()), 'Wrong thumbnail types after setConfig()');
 }
Esempio n. 2
0
 public function testCleanThumbnails()
 {
     $thumbnailPath = $this->autoThumb->getDocumentRoot() . DIRECTORY_SEPARATOR . $this->autoThumb->getThumbnail($this->variables['image'], $this->variables['type']);
     if (file_exists($thumbnailPath)) {
         unlink($thumbnailPath);
     }
     $this->autoThumb->process($this->variables, false);
     $this->autoThumb->cleanThumbnails('images/');
     $this->assertFalse(file_exists($thumbnailPath), 'Clean thumbnails in specified directory does not work.');
     $this->autoThumb->process($this->variables, false);
     $this->autoThumb->cleanThumbnails($this->variables['image']);
     $this->assertFalse(file_exists($thumbnailPath), 'Clean thumbnails for one image does not work.');
 }