Exemple #1
0
 /**
  * @covers Mage_Captcha_Model_Zend::getImgDir
  * @covers Mage_Captcha_Helper_Data::getImgDir
  */
 public function testGetImgDir()
 {
     $captchaTmpDir = TESTS_TEMP_DIR . DIRECTORY_SEPARATOR . 'captcha';
     $option = $this->_getOptionStub();
     $option->expects($this->once())->method('getDir')->will($this->returnValue($captchaTmpDir));
     $config = $this->_getConfigStub();
     $config->expects($this->any())->method('getOptions')->will($this->returnValue($option));
     $object = $this->_getHelper($this->_getStoreStub(), $config);
     $this->assertEquals($object->getImgDir(), Magento_Filesystem::getPathFromArray(array($captchaTmpDir, 'captcha', 'base')) . Magento_Filesystem::DIRECTORY_SEPARATOR);
 }
Exemple #2
0
 /**
  * @expectedException InvalidArgumentException
  * @expectedExceptionMessage Path must contain at least one node
  */
 public function testGetPathFromArrayException()
 {
     Magento_Filesystem::getPathFromArray(array());
 }
Exemple #3
0
 /**
  * Get captcha image directory
  *
  * @param mixed $website
  * @return string
  */
 public function getImgDir($website = null)
 {
     $mediaDir = $this->_config->getOptions()->getDir('media');
     $captchaDir = Magento_Filesystem::getPathFromArray(array($mediaDir, 'captcha', $this->_app->getWebsite($website)->getCode()));
     $this->_filesystem->setWorkingDirectory($mediaDir);
     $this->_filesystem->setIsAllowCreateDirectories(true);
     $this->_filesystem->ensureDirectoryExists($captchaDir, 0755);
     return $captchaDir . Magento_Filesystem::DIRECTORY_SEPARATOR;
 }