Ejemplo n.º 1
0
 public function testCreateImg()
 {
     $config_defaults = self::$configDefaults;
     $base_dir = __DIR__ . '/';
     $config = array('base_dir' => $base_dir);
     foreach (array('jpg', 'png', 'gif') as $ext) {
         $src = self::$imgs[$ext]['file'];
         $width = self::$imgs[$ext]['width'];
         $height = self::$imgs[$ext]['height'];
         $Img = new Img($src, $config);
         $this->assertTrue($Img->isValid(), 'invalid path =' . $Img->getPath());
         $this->assertEquals($src, $Img->getSrc(), $src . ' Img src does not match ' . $Img->getError());
         $this->assertEquals($width, $Img->getInfo('width'), $src . ' Img width does not match ' . $Img->getError());
         $this->assertEquals($height, $Img->getInfo('height'), $src . ' Img height does not match ' . $Img->getError());
         $this->assertEquals(filesize($base_dir . $src), $Img->getInfo('size'), $src . ' Img size does not match ' . $Img->getError());
         foreach ($config_defaults as $k => $v) {
             $val = isset($config[$k]) ? $config[$k] : $v;
             $this->assertEquals($val, $Img->getConfig($k), $src . ' Img config does not match for key ' . $k);
         }
     }
 }