Exemple #1
0
 public function watermarkDataProvider()
 {
     $_tmpPath = Magento_Test_Environment::getInstance()->getTmpDir();
     $imageAbsent = $_tmpPath . DIRECTORY_SEPARATOR . md5(time() + microtime(true)) . '2';
     $imageExists = $_tmpPath . DIRECTORY_SEPARATOR . md5(time() + microtime(true)) . '1';
     touch($imageExists);
     return array(array('', Varien_Image_Adapter_ImageMagick::ERROR_WATERMARK_IMAGE_ABSENT), array($imageAbsent, Varien_Image_Adapter_ImageMagick::ERROR_WATERMARK_IMAGE_ABSENT), array($imageExists, Varien_Image_Adapter_ImageMagick::ERROR_WRONG_IMAGE));
 }
 public function tearDown()
 {
     Magento_Test_Environment::getInstance()->cleanDir(self::$_tmpDir);
 }
Exemple #3
0
 protected function setUp()
 {
     do {
         $this->_actualCsvFile = Magento_Test_Environment::getInstance()->getTmpDir() . DIRECTORY_SEPARATOR . md5(time() + microtime(true));
     } while (file_exists($this->_actualCsvFile));
 }
Exemple #4
0
 /**
  * Write Data into File
  *
  * @param bool $callback
  * @return string
  */
 protected function _writeFile($callback = false)
 {
     $ioFile = new Varien_Io_File();
     $path = Magento_Test_Environment::getInstance()->getTmpDir();
     $name = md5(microtime());
     $file = $path . DIRECTORY_SEPARATOR . $name . '.xml';
     $ioFile->open(array('path' => $path));
     $ioFile->streamOpen($file, 'w+');
     $ioFile->streamLock(true);
     if (!$callback) {
         $convert = new Magento_Convert_Excel(new ArrayIterator($this->_testData));
     } else {
         $convert = new Magento_Convert_Excel(new ArrayIterator($this->_testData), array($this, 'callbackMethod'));
     }
     $convert->write($ioFile);
     $ioFile->streamUnlock();
     $ioFile->streamClose();
     return $file;
 }
Exemple #5
0
 /**
  * @depends testGetInstance
  */
 public function testSetGetInstance()
 {
     Magento_Test_Environment::setInstance($this->_environment);
     $this->assertSame($this->_environment, Magento_Test_Environment::getInstance());
 }
Exemple #6
0
 /**
  * @covers Mage_Captcha_Model_Zend::getImgDir
  * @covers Mage_Captcha_Helper_Data::getImgDir
  */
 public function testGetImgDir()
 {
     $captchaTmpDir = Magento_Test_Environment::getInstance()->getTmpDir() . DIRECTORY_SEPARATOR . 'captcha';
     $option = $this->_getOptionStub();
     $option->expects($this->once())->method('getDir')->will($this->returnValue($captchaTmpDir));
     $this->_object->setOption($option);
     $this->assertEquals($this->_object->getImgDir(), $captchaTmpDir . DIRECTORY_SEPARATOR . 'captcha' . DIRECTORY_SEPARATOR . 'base' . DIRECTORY_SEPARATOR);
 }