Пример #1
0
 public function testGrayscaleRule()
 {
     $chain = new Chain();
     $chain->setRules([new Duplicate(), new Grayscale()]);
     $basePath = __DIR__ . "/image";
     $runner = ChainBuilder::newRunner(["source" => $basePath, "format" => "gs-{NAME}"]);
     $runner->process("5639.jpg", 100)->run($chain);
     $file = glob($basePath . "/gs-5639*");
     $this->assertTrue(file_exists($file[0]));
 }
Пример #2
0
 public function testDuplicateRule()
 {
     $chain = new Chain();
     $chain->setRules([new Duplicate()]);
     $basePath = __DIR__ . "/image";
     $runner = ChainBuilder::newRunner(["source" => $basePath]);
     $runner->process("5639.jpg")->run($chain);
     $file = $runner->getImage()->getFullPath();
     $this->assertTrue(file_exists($file));
     unlink($file);
 }
Пример #3
0
 public function setup()
 {
     $this->_basePath = __DIR__ . "/image";
     $this->_runner = ChainBuilder::newRunner(["source" => $this->_basePath, "format" => "thumb-{NAME}"]);
 }
Пример #4
0
 /**
  * @expectedException \Exception
  * @expectedExceptionMessage Unable to find Rule
  */
 public function testExceptionOnUndefinedRuleClass()
 {
     $chainBuilder = new ChainBuilder();
     $chain = $chainBuilder->convert('[{"rule":"Rule","settings":{"width":20}}]');
 }