Skip to content

Commit

Permalink
Upgrade to use PHP 8 syntax in tests (#126)
Browse files Browse the repository at this point in the history
  • Loading branch information
lruozzi9 committed Apr 4, 2022
1 parent a7279c0 commit dfd590d
Show file tree
Hide file tree
Showing 20 changed files with 48 additions and 202 deletions.
2 changes: 1 addition & 1 deletion spec/ValueHandler/FileAttributeValueHandlerSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

class FileAttributeValueHandlerSpec extends ObjectBehavior
{
const AKENEO_FILE_ATTRIBUTE_CODE = 'allegato_1';
public const AKENEO_FILE_ATTRIBUTE_CODE = 'allegato_1';

function let(
\SplFileInfo $attachmentFile,
Expand Down
4 changes: 2 additions & 2 deletions spec/ValueHandler/GenericPropertyValueHandlerSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ public function it_throws_if_provided_property_path_is_not_writeable_on_both_pro
sprintf(
'Property path "%s" is not writable on both %s and %s but it should be for at least once.',
self::PROPERTY_PATH,
get_class($productVariant->getWrappedObject()),
get_class($product->getWrappedObject())
$productVariant->getWrappedObject()::class,
$product->getWrappedObject()::class
)
)
)
Expand Down
4 changes: 2 additions & 2 deletions spec/ValueHandler/MetricPropertyValueHandlerSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@ public function it_throws_if_provided_property_path_is_not_writeable_on_both_pro
sprintf(
'Property path "%s" is not writable on both %s and %s but it should be for at least once.',
self::PROPERTY_PATH,
get_class($productVariant->getWrappedObject()),
get_class($product->getWrappedObject())
$productVariant->getWrappedObject()::class,
$product->getWrappedObject()::class
)
)
)
Expand Down
14 changes: 2 additions & 12 deletions tests/Behat/Context/Cli/ConsumeCommandContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,8 @@

final class ConsumeCommandContext implements Context
{
/** @var KernelInterface */
private $kernel;

/** @var ConsumeCommand */
private $consumeCommand;

public function __construct(
KernelInterface $kernel,
ConsumeCommand $consumeCommand
) {
$this->kernel = $kernel;
$this->consumeCommand = $consumeCommand;
public function __construct(private KernelInterface $kernel, private ConsumeCommand $consumeCommand)
{
}

/**
Expand Down
19 changes: 2 additions & 17 deletions tests/Behat/Context/Cli/EnqueueCommandContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,8 @@

final class EnqueueCommandContext implements Context
{
/** @var KernelInterface */
private $kernel;

/** @var EnqueueCommand */
private $enqueueCommand;

/** @var SharedStorageInterface */
private $sharedStorage;

public function __construct(
KernelInterface $kernel,
EnqueueCommand $enqueueCommand,
SharedStorageInterface $sharedStorage
) {
$this->kernel = $kernel;
$this->enqueueCommand = $enqueueCommand;
$this->sharedStorage = $sharedStorage;
public function __construct(private KernelInterface $kernel, private EnqueueCommand $enqueueCommand, private SharedStorageInterface $sharedStorage)
{
}

/**
Expand Down
14 changes: 1 addition & 13 deletions tests/Behat/Context/Cli/QueueCleanupCommandContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,8 @@

final class QueueCleanupCommandContext implements Context
{
/** @var KernelInterface */
private $kernel;

/** @var QueueCleanupCommand */
private $queueCleanupCommand;

/** @var SharedStorageInterface */
private $sharedStorage;

public function __construct(KernelInterface $kernel, QueueCleanupCommand $queueCleanupCommand, SharedStorageInterface $sharedStorage)
public function __construct(private KernelInterface $kernel, private QueueCleanupCommand $queueCleanupCommand, private SharedStorageInterface $sharedStorage)
{
$this->kernel = $kernel;
$this->queueCleanupCommand = $queueCleanupCommand;
$this->sharedStorage = $sharedStorage;
}

/**
Expand Down
14 changes: 2 additions & 12 deletions tests/Behat/Context/Cli/ReconcileCommandContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,8 @@

final class ReconcileCommandContext implements Context
{
/** @var KernelInterface */
private $kernel;

/** @var ReconcileCommand */
private $reconcileCommand;

public function __construct(
KernelInterface $kernel,
ReconcileCommand $reconcileCommand
) {
$this->kernel = $kernel;
$this->reconcileCommand = $reconcileCommand;
public function __construct(private KernelInterface $kernel, private ReconcileCommand $reconcileCommand)
{
}

/**
Expand Down
24 changes: 2 additions & 22 deletions tests/Behat/Context/Db/ProductContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,8 @@

final class ProductContext implements Context
{
/** @var ProductRepositoryInterface */
private $productRepository;

/** @var ProductVariantRepositoryInterface */
private $productVariantRepository;

/** @var RepositoryInterface */
private $productAssociationRepository;

/** @var ProductAssociationTypeRepositoryInterface */
private $productAssociationTypeRepository;

public function __construct(
ProductRepositoryInterface $productRepository,
ProductVariantRepositoryInterface $productVariantRepository,
RepositoryInterface $productAssociationRepository,
ProductAssociationTypeRepositoryInterface $productAssociationTypeRepository
) {
$this->productRepository = $productRepository;
$this->productVariantRepository = $productVariantRepository;
$this->productAssociationRepository = $productAssociationRepository;
$this->productAssociationTypeRepository = $productAssociationTypeRepository;
public function __construct(private ProductRepositoryInterface $productRepository, private ProductVariantRepositoryInterface $productVariantRepository, private RepositoryInterface $productAssociationRepository, private ProductAssociationTypeRepositoryInterface $productAssociationTypeRepository)
{
}

/**
Expand Down
9 changes: 2 additions & 7 deletions tests/Behat/Context/Db/QueueContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,8 @@

final class QueueContext implements Context
{
/** @var QueueItemRepositoryInterface */
private $queueItemRepository;

public function __construct(
QueueItemRepositoryInterface $queueItemRepository
) {
$this->queueItemRepository = $queueItemRepository;
public function __construct(private QueueItemRepositoryInterface $queueItemRepository)
{
}

/**
Expand Down
6 changes: 1 addition & 5 deletions tests/Behat/Context/Setup/AkeneoContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,8 @@

final class AkeneoContext implements Context
{
/** @var ApiClientInterface|ApiClientMock */
private $apiClient;

public function __construct(ApiClientInterface $apiClient)
public function __construct(private ApiClientInterface $apiClient)
{
$this->apiClient = $apiClient;
}

/**
Expand Down
19 changes: 2 additions & 17 deletions tests/Behat/Context/Setup/QueueContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,8 @@

final class QueueContext implements Context
{
/** @var FactoryInterface */
private $queueItemFactory;

/** @var QueueItemRepositoryInterface */
private $queueItemRepository;

/** @var SharedStorageInterface */
private $sharedStorage;

public function __construct(
FactoryInterface $queueItemFactory,
QueueItemRepositoryInterface $queueItemRepository,
SharedStorageInterface $sharedStorage
) {
$this->queueItemFactory = $queueItemFactory;
$this->queueItemRepository = $queueItemRepository;
$this->sharedStorage = $sharedStorage;
public function __construct(private FactoryInterface $queueItemFactory, private QueueItemRepositoryInterface $queueItemRepository, private SharedStorageInterface $sharedStorage)
{
}

/**
Expand Down
13 changes: 2 additions & 11 deletions tests/Behat/Context/System/FilesystemContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,10 @@

final class FilesystemContext implements Context
{
/** @var vfsStreamContainer */
private $vfsStream;
private ?vfsStreamContainer $vfsStream = null;

/** @var string */
private $temporaryDirectory;

/** @var string */
private $temporaryFilesPrefix;

public function __construct(string $temporaryDirectory, string $temporaryFilesPrefix)
public function __construct(private string $temporaryDirectory, private string $temporaryFilesPrefix)
{
$this->temporaryDirectory = $temporaryDirectory;
$this->temporaryFilesPrefix = $temporaryFilesPrefix;
}

/**
Expand Down
6 changes: 1 addition & 5 deletions tests/Behat/Context/Transform/QueueItemContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,8 @@

final class QueueItemContext implements Context
{
/** @var QueueItemRepositoryInterface */
private $queueItemRepository;

public function __construct(QueueItemRepositoryInterface $queueItemRepository)
public function __construct(private QueueItemRepositoryInterface $queueItemRepository)
{
$this->queueItemRepository = $queueItemRepository;
}

/**
Expand Down
24 changes: 2 additions & 22 deletions tests/Behat/Context/Ui/Admin/ManagingProductsContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,31 +18,11 @@ final class ManagingProductsContext implements Context
{
private const SCHEDULE_AKENEO_PIM_IMPORT = 'Schedule Akeneo PIM import';

/** @var IndexPageInterface */
private $indexPage;

/** @var JavaScriptTestHelperInterface */
private $testHelper;

/** @var NotificationCheckerInterface */
private $notificationChecker;

/** @var QueueItemsIndexPageInterface */
private $queueItemsIndexPage;

/**
* ProductItems constructor.
*/
public function __construct(
IndexPageInterface $indexPage,
JavaScriptTestHelperInterface $testHelper,
NotificationCheckerInterface $notificationChecker,
QueueItemsIndexPageInterface $queueItemsIndexPage
) {
$this->indexPage = $indexPage;
$this->testHelper = $testHelper;
$this->notificationChecker = $notificationChecker;
$this->queueItemsIndexPage = $queueItemsIndexPage;
public function __construct(private IndexPageInterface $indexPage, private JavaScriptTestHelperInterface $testHelper, private NotificationCheckerInterface $notificationChecker, private QueueItemsIndexPageInterface $queueItemsIndexPage)
{
}

/**
Expand Down
10 changes: 1 addition & 9 deletions tests/Behat/Context/Ui/Admin/ManagingQueueItems.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,8 @@

final class ManagingQueueItems implements Context
{
/** @var IndexPageInterface */
private $indexPage;

/** @var SharedStorageInterface */
private $sharedStorage;

public function __construct(IndexPageInterface $indexPage, SharedStorageInterface $sharedStorage)
public function __construct(private IndexPageInterface $indexPage, private SharedStorageInterface $sharedStorage)
{
$this->indexPage = $indexPage;
$this->sharedStorage = $sharedStorage;
}

/**
Expand Down
9 changes: 3 additions & 6 deletions tests/Integration/AttributeOptions/ImporterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,11 @@

final class ImporterTest extends KernelTestCase
{
/** @var ImporterInterface */
private $importer;
private ImporterInterface $importer;

/** @var PurgerLoader */
private $fixtureLoader;
private PurgerLoader $fixtureLoader;

/** @var RepositoryInterface */
private $attributeRepository;
private RepositoryInterface $attributeRepository;

protected function setUp(): void
{
Expand Down
18 changes: 6 additions & 12 deletions tests/Integration/Product/ImporterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,17 @@

final class ImporterTest extends KernelTestCase
{
/** @var ImporterInterface */
private $importer;
private ImporterInterface $importer;

/** @var ProductRepositoryInterface */
private $productRepository;
private ProductRepositoryInterface $productRepository;

/** @var ProductVariantRepository */
private $productVariantRepository;
private ProductVariantRepository $productVariantRepository;

/** @var PurgerLoader */
private $fixtureLoader;
private PurgerLoader $fixtureLoader;

/** @var ChannelRepository */
private $channelRepository;
private ChannelRepository $channelRepository;

/** @var Filesystem */
private $filesystem;
private Filesystem $filesystem;

protected function setUp(): void
{
Expand Down
18 changes: 6 additions & 12 deletions tests/Integration/Product/ReconcilerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,17 @@

final class ReconcilerTest extends KernelTestCase
{
/** @var ReconcilerInterface */
private $reconciler;
private ReconcilerInterface $reconciler;

/** @var ProductRepositoryInterface */
private $productRepository;
private ProductRepositoryInterface $productRepository;

/** @var ProductVariantRepository */
private $productVariantRepository;
private ProductVariantRepository $productVariantRepository;

/** @var PurgerLoader */
private $fixtureLoader;
private PurgerLoader $fixtureLoader;

/** @var ChannelRepository */
private $channelRepository;
private ChannelRepository $channelRepository;

/** @var Filesystem */
private $filesystem;
private Filesystem $filesystem;

protected function setUp(): void
{
Expand Down
9 changes: 3 additions & 6 deletions tests/Integration/ProductAssociations/ImporterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,11 @@

final class ImporterTest extends KernelTestCase
{
/** @var ImporterInterface */
private $importer;
private ImporterInterface $importer;

/** @var PurgerLoader */
private $fixtureLoader;
private PurgerLoader $fixtureLoader;

/** @var ProductRepositoryInterface */
private $productRepository;
private ProductRepositoryInterface $productRepository;

protected function setUp(): void
{
Expand Down
Loading

0 comments on commit dfd590d

Please sign in to comment.