/**
  * Avoid impact of initialized \Magento\Framework\Code\Generator\Autoloader on other tests
  */
 public static function tearDownAfterClass()
 {
     foreach (spl_autoload_functions() as $autoloadFunction) {
         spl_autoload_unregister($autoloadFunction);
     }
     foreach (self::$originalAutoloadFunctions as $autoloadFunction) {
         spl_autoload_register($autoloadFunction);
     }
     set_include_path(self::$originalIncludePath);
     \Magento\Framework\Filesystem\Io\File::rmdirRecursive(__DIR__ . '/_files/var/');
 }
 /**
  * Get report info for contacts sync.
  *
  * @param int $id
  * @param int $websiteId
  *
  * @throws \Magento\Framework\Exception\LocalizedException
  */
 public function _processContactImportReportFaults($id, $websiteId)
 {
     $client = $this->helper->getWebsiteApiClient($websiteId);
     $response = $client->getContactImportReportFaults($id);
     if ($response) {
         $data = $this->_removeUtf8Bom($response);
         $fileName = $this->directoryList->getPath('var') . DIRECTORY_SEPARATOR . 'DmTempCsvFromApi.csv';
         $this->file->open();
         $check = $this->file->write($fileName, $data);
         if ($check) {
             $csvArray = $this->_csvToArray($fileName);
             $this->file->rm($fileName);
             $this->contact->unsubscribe($csvArray);
         } else {
             $this->helper->log('_processContactImportReportFaults: cannot save data to CSV file.');
         }
     }
 }
示例#3
0
文件: Builder.php 项目: nhc/Umc_Base
 /**
  * @return $this
  */
 public function cleanup()
 {
     $basePath = trim($this->getBaseWritePath(true), '/');
     $this->io->rmdir($basePath, true);
     return $this;
 }
示例#4
0
 /**
  * @param $file
  * @return bool|string
  * @throws \Exception
  */
 protected function readSourceFile($file)
 {
     if (!is_file($file)) {
         throw new \Exception("Trying to load file '{$file}' that does not exist.");
     }
     return $this->io->read($file);
 }
示例#5
0
 /**
  * read source file
  *
  * @param $file
  * @return bool|string
  */
 protected function readSourceFile($file)
 {
     return $this->io->read($file);
 }
示例#6
0
文件: Path.php 项目: mage2pro/core
 /**
  * @param string $path
  * @return void
  */
 public function delete($path)
 {
     df_param_string_not_empty($path, 0);
     \Magento\Framework\Filesystem\Io\File::rmdirRecursive($path);
 }