|
Apache/2.4.41 (Ubuntu) Linux vmi616275.contaboserver.net 5.4.0-84-generic #94-Ubuntu SMP Thu Aug 26 20:27:37 UTC 2021 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) server ip : 62.171.164.128 | your ip : 127.0.0.1 safemode OFF > / home / a / home / dev2.destoffenstraat.com / app / Firebear / ImportExport / Test / Integration / |
Filename | /home/a/home/dev2.destoffenstraat.com/app/Firebear/ImportExport/Test/Integration/AbstractImport.php |
Size | 2.43 kb |
Permission | rw-rw-r-- |
Owner | root : root |
Create time | 21-Aug-2025 12:26 |
Last modified | 07-Nov-2022 06:44 |
Last accessed | 22-Aug-2025 22:56 |
Actions | edit | rename | delete | download (gzip) |
View | text | code | image |
<?php
namespace Firebear\ImportExport\Test\Integration;
use Firebear\ImportExport\Api\JobRepositoryInterface;
use Magento\Catalog\Api\ProductRepositoryInterface;
use Magento\Framework\Api\SearchCriteriaBuilder;
use Magento\Framework\ObjectManagerInterface;
use Magento\TestFramework\Helper\Bootstrap;
use Exception;
class AbstractImport extends \PHPUnit\Framework\TestCase
{
/**
* @var ObjectManagerInterface
*/
protected $objectManager;
/**
* @var JobRepositoryInterface
*/
protected $jobRepository;
/**
* @var ProductRepositoryInterface
*/
protected $productRepository;
/**
* @var \Magento\Framework\Filesystem\Driver\File
*/
protected $driverFile;
/**
* @var \Firebear\ImportExport\Test\Integration\Helpers\JobFixturesManager
*/
protected $jobFixtureManager;
protected function setUp(): void
{
/** @phpstan-ignore-next-line */
$this->objectManager = Bootstrap::getObjectManager();
$this->jobRepository = $this->objectManager->get(JobRepositoryInterface::class);
$this->productRepository = $this->objectManager->get(ProductRepositoryInterface::class);
$this->driverFile = $this->objectManager->get(\Magento\Framework\Filesystem\Driver\File::class);
$this->jobFixtureManager = $this->objectManager->get(
\Firebear\ImportExport\Test\Integration\Helpers\JobFixturesManager::class
);
}
/**
* @param string $sourcePath
* @param string $destPath
* @throws \Magento\Framework\Exception\FileSystemException
*/
protected function copyFile(string $sourcePath, string $destPath)
{
if (!$this->driverFile->isExists($sourcePath)) {
throw new Exception('File not found. Path: ' . $sourcePath);
}
if (!$this->driverFile->isWritable(dirname($destPath))) {
$this->driverFile->createDirectory(dirname($destPath));
}
if (!$this->driverFile->copy($sourcePath, $destPath)) {
throw new Exception('Failed to copy file');
}
}
/**
* @return \Magento\Catalog\Api\Data\ProductSearchResultsInterface
*/
protected function getAllProducts()
{
/** @var SearchCriteriaBuilder $searchCriteriaBuilder */
$searchCriteriaBuilder = $this->objectManager->get(SearchCriteriaBuilder::class);
return $this->productRepository->getList($searchCriteriaBuilder->create());
}
}
namespace Firebear\ImportExport\Test\Integration;
use Firebear\ImportExport\Api\JobRepositoryInterface;
use Magento\Catalog\Api\ProductRepositoryInterface;
use Magento\Framework\Api\SearchCriteriaBuilder;
use Magento\Framework\ObjectManagerInterface;
use Magento\TestFramework\Helper\Bootstrap;
use Exception;
class AbstractImport extends \PHPUnit\Framework\TestCase
{
/**
* @var ObjectManagerInterface
*/
protected $objectManager;
/**
* @var JobRepositoryInterface
*/
protected $jobRepository;
/**
* @var ProductRepositoryInterface
*/
protected $productRepository;
/**
* @var \Magento\Framework\Filesystem\Driver\File
*/
protected $driverFile;
/**
* @var \Firebear\ImportExport\Test\Integration\Helpers\JobFixturesManager
*/
protected $jobFixtureManager;
protected function setUp(): void
{
/** @phpstan-ignore-next-line */
$this->objectManager = Bootstrap::getObjectManager();
$this->jobRepository = $this->objectManager->get(JobRepositoryInterface::class);
$this->productRepository = $this->objectManager->get(ProductRepositoryInterface::class);
$this->driverFile = $this->objectManager->get(\Magento\Framework\Filesystem\Driver\File::class);
$this->jobFixtureManager = $this->objectManager->get(
\Firebear\ImportExport\Test\Integration\Helpers\JobFixturesManager::class
);
}
/**
* @param string $sourcePath
* @param string $destPath
* @throws \Magento\Framework\Exception\FileSystemException
*/
protected function copyFile(string $sourcePath, string $destPath)
{
if (!$this->driverFile->isExists($sourcePath)) {
throw new Exception('File not found. Path: ' . $sourcePath);
}
if (!$this->driverFile->isWritable(dirname($destPath))) {
$this->driverFile->createDirectory(dirname($destPath));
}
if (!$this->driverFile->copy($sourcePath, $destPath)) {
throw new Exception('Failed to copy file');
}
}
/**
* @return \Magento\Catalog\Api\Data\ProductSearchResultsInterface
*/
protected function getAllProducts()
{
/** @var SearchCriteriaBuilder $searchCriteriaBuilder */
$searchCriteriaBuilder = $this->objectManager->get(SearchCriteriaBuilder::class);
return $this->productRepository->getList($searchCriteriaBuilder->create());
}
}