public function testCreateDirIfNotExistsNegativeResult() { $checkDir = __DIR__ . DIRECTORY_SEPARATOR . 'dirNotExists'; $this->_sourceData['io']->expects($this->at(0))->method('checkAndCreateFolder')->with($this->equalTo($this->_varDir))->will($this->returnValue(true)); $this->_sourceData['io']->expects($this->at(1))->method('checkAndCreateFolder')->will($this->throwException(new Exception())); $this->_model = new Mage_Core_Model_Config_Options($this->_sourceData); $result = $this->_model->createDirIfNotExists($checkDir); $this->assertEquals(false, $result); }
public function testCreateDirIfNotExists() { $var = $this->_model->getVarDir(); $sampleDir = uniqid($var); $this->assertTrue($this->_model->createDirIfNotExists($sampleDir)); $this->assertTrue($this->_model->createDirIfNotExists($sampleDir)); rmdir($sampleDir); $sampleFile = "{$var}/" . uniqid('file') . '.txt'; file_put_contents($sampleFile, '1'); $this->assertFalse($this->_model->createDirIfNotExists($sampleFile)); unlink($sampleFile); }