protected function setUp()
 {
     $this->_magento = Helper::createTempDir();
     $this->_target = Helper::createTempDir();
     $this->_temp = Helper::createTempDir();
     Helper::emulateMagentoFileStructure($this->_magento);
     $this->_installMagento();
 }
 public function testShouldCleanupTargetIfErrorOccuredDuringInstallation()
 {
     // prepare
     Helper::emulateMagentoFileStructure($this->_magento);
     $installer = new MagentoWithMockedRun($this->_target, $this->_magento, self::DB_HOSTNAME, self::DB_USERNAME, self::DB_PASSWORD, self::DB_NAME, 'url');
     $installer->setThrowExceptionFromInstall(true);
     // act
     try {
         $installer->install();
     } catch (MyException $e) {
     }
     // assert
     $this->assertFalse($installer->isInstalled());
     foreach (new \DirectoryIterator($this->_target) as $item) {
         if (!$item->isDot()) {
             $this->fail('Target is not empty.');
         }
     }
 }