Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,10 @@ jobs:

- uses: cachix/install-nix-action@v17
with:
nix_path: nixpkgs=channel:nixos-unstable
nix_path: nixpkgs=channel:nixos-unstable:phps=https://github.com/fossar/nix-phps/archive/master.tar.gz
extra_nix_config: |
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= fossar.cachix.org-1:Zv6FuqIboeHPWQS7ysLCJ7UT7xExb4OE8c4LyGb5AsE=
substituters = https://cache.nixos.org/ https://fossar.cachix.org

- name: Run Unit Tests PHP8.1
run: nix-shell --arg phpVersion \"php81\" --pure --run project-test-unit
Expand Down Expand Up @@ -142,7 +145,10 @@ jobs:

- uses: cachix/install-nix-action@v17
with:
nix_path: nixpkgs=channel:nixos-unstable
nix_path: nixpkgs=channel:nixos-unstable:phps=https://github.com/fossar/nix-phps/archive/master.tar.gz
extra_nix_config: |
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= fossar.cachix.org-1:Zv6FuqIboeHPWQS7ysLCJ7UT7xExb4OE8c4LyGb5AsE=
substituters = https://cache.nixos.org/ https://fossar.cachix.org

- name: Run Acceptance Tests PHP8.1
run: nix-shell --arg phpVersion \"php81\" --pure --run project-test-acceptance
Expand Down
14 changes: 0 additions & 14 deletions Build/UnitTests.xml

This file was deleted.

5 changes: 4 additions & 1 deletion Build/FunctionalTests.xml → Build/phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="true" bootstrap="../vendor/typo3/testing-framework/Resources/Core/Build/FunctionalTestsBootstrap.php" colors="true" stopOnError="false" stopOnFailure="false" stopOnIncomplete="false" stopOnSkipped="false" beStrictAboutTestsThatDoNotTestAnything="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.1/phpunit.xsd" cacheDirectory=".phpunit.cache" requireCoverageMetadata="false">
<coverage/>
<testsuites>
<testsuite name="Cart Products Extension">
<testsuite name="functional">
<directory>../Tests/Functional/</directory>
</testsuite>
<testsuite name="unit">
<directory>../Tests/Unit/</directory>
</testsuite>
</testsuites>
<source>
<include>
Expand Down
4 changes: 2 additions & 2 deletions Classes/Controller/ProductController.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ protected function createDemandObjectFromSettings(array $settings): ProductDeman
}
if ($settings['orderBy']) {
if (
!isset($settings['orderDirection']) &&
$settings['orderDirection'] !== 'DESC'
!isset($settings['orderDirection'])
&& $settings['orderDirection'] !== 'DESC'
) {
$settings['orderDirection'] = 'ASC';
}
Expand Down
58 changes: 29 additions & 29 deletions Classes/Domain/Model/Product/BeVariant.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ public function getPriceCalculated(): float
};

if (
isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['cart']['changeVariantDiscount']) &&
is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['cart']['changeVariantDiscount'])
isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['cart']['changeVariantDiscount'])
&& is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['cart']['changeVariantDiscount'])
) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['cart']['changeVariantDiscount'] as $funcRef) {
if ($funcRef) {
Expand Down Expand Up @@ -144,8 +144,8 @@ public function getBestPriceCalculated($frontendUserGroupIds = []): float
};

if (
isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['cart']['changeVariantDiscount']) &&
is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['cart']['changeVariantDiscount'])
isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['cart']['changeVariantDiscount'])
&& is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['cart']['changeVariantDiscount'])
) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['cart']['changeVariantDiscount'] as $funcRef) {
if ($funcRef) {
Expand Down Expand Up @@ -226,8 +226,8 @@ public function getBestSpecialPrice(array $frontendUserGroupIds = []): ?SpecialP

foreach ($this->getSpecialPrices() as $specialPrice) {
if ($bestSpecialPrice === null) {
if (!$specialPrice->getFrontendUserGroup() ||
in_array($specialPrice->getFrontendUserGroup()->getUid(), $frontendUserGroupIds)
if (!$specialPrice->getFrontendUserGroup()
|| in_array($specialPrice->getFrontendUserGroup()->getUid(), $frontendUserGroupIds)
) {
$bestSpecialPrice = $specialPrice;
}
Expand All @@ -236,16 +236,16 @@ public function getBestSpecialPrice(array $frontendUserGroupIds = []): ?SpecialP

if (
(
($specialPrice->getPrice() < $bestSpecialPrice->getPrice()) &&
in_array($this->priceCalcMethod, [0, 1, 4, 5])
) ||
(
($specialPrice->getPrice() > $bestSpecialPrice->getPrice()) &&
in_array($this->priceCalcMethod, [2, 3])
($specialPrice->getPrice() < $bestSpecialPrice->getPrice())
&& in_array($this->priceCalcMethod, [0, 1, 4, 5])
)
|| (
($specialPrice->getPrice() > $bestSpecialPrice->getPrice())
&& in_array($this->priceCalcMethod, [2, 3])
)
) {
if (!$specialPrice->getFrontendUserGroup() ||
in_array($specialPrice->getFrontendUserGroup()->getUid(), $frontendUserGroupIds)
if (!$specialPrice->getFrontendUserGroup()
|| in_array($specialPrice->getFrontendUserGroup()->getUid(), $frontendUserGroupIds)
) {
$bestSpecialPrice = $specialPrice;
}
Expand All @@ -263,12 +263,12 @@ public function getBestPrice(array $frontendUserGroupIds = []): float
if ($bestSpecialPrice) {
if (
(
($bestSpecialPrice->getPrice() < $bestPrice) &&
in_array($this->priceCalcMethod, [0, 1, 4, 5])
) ||
(
($bestSpecialPrice->getPrice() > $bestPrice) &&
in_array($this->priceCalcMethod, [2, 3])
($bestSpecialPrice->getPrice() < $bestPrice)
&& in_array($this->priceCalcMethod, [0, 1, 4, 5])
)
|| (
($bestSpecialPrice->getPrice() > $bestPrice)
&& in_array($this->priceCalcMethod, [2, 3])
)
) {
$bestPrice = $bestSpecialPrice->getPrice();
Expand Down Expand Up @@ -301,9 +301,9 @@ public function getBasePrice(): ?float
{
//TODO: respects different measuring units between variant and product
if (
!$this->product ||
!$this->product->getIsMeasureUnitCompatibility() ||
!$this->getPriceMeasure() > 0
!$this->product
|| !$this->product->getIsMeasureUnitCompatibility()
|| !$this->getPriceMeasure() > 0
) {
return null;
}
Expand Down Expand Up @@ -424,20 +424,20 @@ public function getTitle(): string
$titleArray = [];

if ($this->getProduct()->getBeVariantAttribute1()) {
$titleArray[] =
$this->getProduct()->getBeVariantAttribute1()->getTitle()
$titleArray[]
= $this->getProduct()->getBeVariantAttribute1()->getTitle()
. ' '
. $this->getBeVariantAttributeOption1()->getTitle();
}
if ($this->getProduct()->getBeVariantAttribute2()) {
$titleArray[] =
$this->getProduct()->getBeVariantAttribute2()->getTitle()
$titleArray[]
= $this->getProduct()->getBeVariantAttribute2()->getTitle()
. ' '
. $this->getBeVariantAttributeOption2()->getTitle();
}
if ($this->getProduct()->getBeVariantAttribute3()) {
$titleArray[] =
$this->getProduct()->getBeVariantAttribute3()->getTitle()
$titleArray[]
= $this->getProduct()->getBeVariantAttribute3()->getTitle()
. ' '
. $this->getBeVariantAttributeOption3()->getTitle();
}
Expand Down
8 changes: 4 additions & 4 deletions Classes/Domain/Model/Product/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@ public function getBestSpecialPrice(array $frontendUserGroupIds = []): float
foreach ($this->specialPrices as $specialPrice) {
if ($specialPrice->getPrice() < $bestSpecialPrice) {
if (
!$specialPrice->getFrontendUserGroup() ||
in_array($specialPrice->getFrontendUserGroup()->getUid(), $frontendUserGroupIds)
!$specialPrice->getFrontendUserGroup()
|| in_array($specialPrice->getFrontendUserGroup()->getUid(), $frontendUserGroupIds)
) {
$bestSpecialPrice = $specialPrice->getPrice();
}
Expand Down Expand Up @@ -238,8 +238,8 @@ public function getQuantityDiscountArray(array $frontendUserGroupIds = []): arra

if ($this->getQuantityDiscounts()) {
foreach ($this->getQuantityDiscounts() as $quantityDiscount) {
if (!$quantityDiscount->getFrontendUserGroup() ||
in_array($quantityDiscount->getFrontendUserGroup()->getUid(), $frontendUserGroupIds)
if (!$quantityDiscount->getFrontendUserGroup()
|| in_array($quantityDiscount->getFrontendUserGroup()->getUid(), $frontendUserGroupIds)
) {
$quantityDiscountArray[] = $quantityDiscount->toArray();
}
Expand Down
12 changes: 6 additions & 6 deletions Classes/Domain/Repository/CategoryRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ public function findAllAsArray(?Category $selectedCategory = null): array
$newCategory = [
'uid' => $localCategory->getUid(),
'title' => $localCategory->getTitle(),
'parent' =>
($localCategory->getParent() ? $localCategory->getParent()->getUid() : null),
'parent'
=> ($localCategory->getParent() ? $localCategory->getParent()->getUid() : null),
'subcategories' => null,
'isSelected' => ($selectedCategory === $localCategory),
];
Expand All @@ -47,8 +47,8 @@ public function findSubcategoriesRecursiveAsArray(?Category $parentCategory = nu
$localCategories = $this->findAllAsArray();
foreach ($localCategories as $category) {
if (
!$parentCategory ||
$category['uid'] === $parentCategory->getUid()
!$parentCategory
|| $category['uid'] === $parentCategory->getUid()
) {
$this->getSubcategoriesIds(
$localCategories,
Expand Down Expand Up @@ -83,8 +83,8 @@ protected function buildSubcategories(array $categoriesArray, array $parentCateg
foreach ($categoriesArray as $category) {
if ($category['parent'] === $parentCategory['uid']) {
$newCategory = $category;
$newCategory['subcategories'] =
$this->buildSubcategories($categoriesArray, $category);
$newCategory['subcategories']
= $this->buildSubcategories($categoriesArray, $category);
$categories[] = $newCategory;
}
}
Expand Down
8 changes: 4 additions & 4 deletions Classes/Domain/Repository/Product/ProductRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,15 @@ protected function createOrderingsFromDemand(ProductDemand $demand): array

if (!empty($orderList)) {
foreach ($orderList as $orderItem) {
[$orderField, $orderDirection] =
array_pad(
[$orderField, $orderDirection]
= array_pad(
GeneralUtility::trimExplode(' ', $orderItem, true),
2,
'asc'
);
if (
$orderDirection &&
strtolower($orderDirection) === 'desc'
$orderDirection
&& strtolower($orderDirection) === 'desc'
) {
$orderings[$orderField] = QueryInterface::ORDER_DESCENDING;
} else {
Expand Down
6 changes: 3 additions & 3 deletions Classes/EventListener/CheckProductAvailability.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ public function checkStockForBeVariant(CartProductBeVariant $cartProductBeVarian
}

if (
$mode === 'add' &&
$cart->getProductById($cartProduct->getId()) &&
$cart->getProductById($cartProduct->getId())->getBeVariantById($cartProductBeVariant->getId())
$mode === 'add'
&& $cart->getProductById($cartProduct->getId())
&& $cart->getProductById($cartProduct->getId())->getBeVariantById($cartProductBeVariant->getId())
) {
$quantityInCart += $cart->getProductById($cartProduct->getId())->getBeVariantById($cartProductBeVariant->getId())->getQuantity();
}
Expand Down
8 changes: 4 additions & 4 deletions Classes/EventListener/Create/CheckRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ public function __invoke(RetrieveProductsFromRequestEvent $event): void
$request = $event->getRequest();

if (
!$request->hasArgument('product') ||
!(int)$request->getArgument('product')
!$request->hasArgument('product')
|| !(int)$request->getArgument('product')
) {
$event->addError(
new FlashMessage(
Expand All @@ -39,8 +39,8 @@ public function __invoke(RetrieveProductsFromRequestEvent $event): void
}

if (
!$request->hasArgument('quantity') ||
$request->getArgument('quantity') < 0
!$request->hasArgument('quantity')
|| $request->getArgument('quantity') < 0
) {
$event->addError(
new FlashMessage(
Expand Down
8 changes: 4 additions & 4 deletions Classes/Hooks/DatamapDataHandlerHook.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,11 @@ protected function isAllowedTargetPage($listType, $doktype)
($doktype === 183) && (
$listType === 'cartproducts_singleproduct'
)
) ||
(
)
|| (
($doktype !== 183) && (
$listType === 'cartproducts_products' ||
$listType === 'cartproducts_slots'
$listType === 'cartproducts_products'
|| $listType === 'cartproducts_slots'
)
)
) {
Expand Down
4 changes: 2 additions & 2 deletions Classes/Updates/SwitchableControllerActionsPluginUpdater.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ protected function getMigrationRecords(): array
protected function getTargetListType(string $sourceListType, string $switchableControllerActions): string
{
foreach (self::MIGRATION_SETTINGS as $setting) {
if ($setting['sourceListType'] === $sourceListType &&
$setting['switchableControllerActions'] === $switchableControllerActions
if ($setting['sourceListType'] === $sourceListType
&& $setting['switchableControllerActions'] === $switchableControllerActions
) {
return $setting['targetListType'];
}
Expand Down
4 changes: 2 additions & 2 deletions Classes/ViewHelpers/CanonicalTagViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ public function render(): string
}

$arguments = [
['tx_cartproducts_product' =>
[
['tx_cartproducts_product'
=> [
'controller' => 'Product',
'product' => $product->getUid(),
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@

// prepend category restriction at the beginning of foreign_table_where
if (!empty($categoryRestriction)) {
$GLOBALS['TCA']['tx_cartproducts_domain_model_product_product']['columns']['category']['config']['foreign_table_where'] = $categoryRestriction .
$GLOBALS['TCA']['tx_cartproducts_domain_model_product_product']['columns']['category']['config']['foreign_table_where'];
$GLOBALS['TCA']['tx_cartproducts_domain_model_product_product']['columns']['categories']['config']['foreign_table_where'] = $categoryRestriction .
$GLOBALS['TCA']['tx_cartproducts_domain_model_product_product']['columns']['categories']['config']['foreign_table_where'];
$GLOBALS['TCA']['tx_cartproducts_domain_model_product_product']['columns']['category']['config']['foreign_table_where'] = $categoryRestriction
. $GLOBALS['TCA']['tx_cartproducts_domain_model_product_product']['columns']['category']['config']['foreign_table_where'];
$GLOBALS['TCA']['tx_cartproducts_domain_model_product_product']['columns']['categories']['config']['foreign_table_where'] = $categoryRestriction
. $GLOBALS['TCA']['tx_cartproducts_domain_model_product_product']['columns']['categories']['config']['foreign_table_where'];
}
}
Loading