Skip to content

Commit

Permalink
updated master branch by changes in 9.1 branch
Browse files Browse the repository at this point in the history
  • Loading branch information
David Stritezsky committed May 14, 2021
2 parents 1c0ca51 + 2949f04 commit 84a6f85
Show file tree
Hide file tree
Showing 15 changed files with 67 additions and 39 deletions.
1 change: 1 addition & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ Follow the instructions in the [monorepo upgrade guide](upgrade/upgrading-monore
* even we care a lot about these instructions, it is possible we miss something. In case something doesn't work after the upgrade, you'll find more information in the [CHANGELOG](CHANGELOG.md)

## Upgrade guides
* ### [From v9.1.0 to v9.1.1](/upgrade/UPGRADE-v9.1.1.md)
* ### [From v9.0.4 to v9.1.0](/upgrade/UPGRADE-v9.1.0.md)
* ### [From v9.0.3 to v9.0.4](/upgrade/UPGRADE-v9.0.4.md)
* ### [From v9.0.2 to v9.0.3](/upgrade/UPGRADE-v9.0.3.md)
Expand Down
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"arvenil/ninja-mutex": "^0.4.1",
"barryvdh/elfinder-flysystem-driver": "^0.2",
"commerceguys/intl": "^1.0.0",
"composer/composer": "^1.6.0",
"composer/composer": "^1.10.22",
"craue/formflow-bundle": "^3.0.3",
"defuse/php-encryption": "^2.2.1",
"doctrine/annotations": "^1.6.0",
Expand Down Expand Up @@ -182,7 +182,8 @@
"conflict": {
"symfony/symfony": "*",
"symfony/dependency-injection": ">=4.4.19",
"codeception/codeception": ">=4.1.19"
"codeception/codeception": ">=4.1.19",
"friendsofphp/php-cs-fixer": "2.19.0"
},
"scripts": {
"post-install-cmd": [
Expand Down
3 changes: 2 additions & 1 deletion packages/coding-standards/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
}
],
"conflict": {
"symfony/dependency-injection": ">=4.4.19 <5.0.0 || 5.1.11 || >=5.2.2"
"symfony/dependency-injection": ">=4.4.19 <5.0.0 || 5.1.11 || >=5.2.2",
"friendsofphp/php-cs-fixer": "2.19.0"
},
"require": {
"php": "^7.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/framework/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"arvenil/ninja-mutex": "^0.4.1",
"barryvdh/elfinder-flysystem-driver": "^0.2",
"commerceguys/intl": "^1.0.0",
"composer/composer": "^1.6.0",
"composer/composer": "^1.10.22",
"craue/formflow-bundle": "^3.0.3",
"defuse/php-encryption": "^2.2.1",
"doctrine/annotations": "^1.6",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,15 @@ public function buildForm(FormBuilderInterface $builder, array $options)
}

/**
* @param string $email
* @param string|null $email
* @param \Symfony\Component\Validator\Context\ExecutionContextInterface $context
*/
public function validateUniqueEmail(string $email, ExecutionContextInterface $context): void
public function validateUniqueEmail(?string $email, ExecutionContextInterface $context): void
{
if ($email === null) {
return;
}

/** @var \Symfony\Component\Form\Form $form */
$form = $context->getRoot();
/** @var \Shopsys\FrameworkBundle\Model\Customer\User\CustomerUserData $customerUserData */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ public function getProductFilterCountDataForAll(
* @param int $limit
* @param int $categoryId
* @return \Shopsys\FrameworkBundle\Model\Product\Search\FilterQuery
* @deprecated This method will be removed in next major version. Use \Shopsys\FrameworkBundle\Model\Product\Search\ProductFilterQueryFactory::createListableProductsByCategoryId() instead.
* @deprecated This method will be removed in next major version. Use \Shopsys\FrameworkBundle\Model\Product\Search\FilterQueryFactory::createListableProductsByCategoryId() instead.
*/
protected function createListableProductsInCategoryFilterQuery(
ProductFilterData $productFilterData,
Expand All @@ -336,7 +336,7 @@ protected function createListableProductsInCategoryFilterQuery(
* @param int $limit
* @param int $brandId
* @return \Shopsys\FrameworkBundle\Model\Product\Search\FilterQuery
* @deprecated This method will be removed in next major version. Use \Shopsys\FrameworkBundle\Model\Product\Search\ProductFilterQueryFactory::createListableProductsByBrandId() instead.
* @deprecated This method will be removed in next major version. Use \Shopsys\FrameworkBundle\Model\Product\Search\FilterQueryFactory::createListableProductsByBrandId() instead.
*/
protected function createListableProductsForBrandFilterQuery(
ProductFilterData $productFilterData,
Expand All @@ -361,7 +361,7 @@ protected function createListableProductsForBrandFilterQuery(
* @param int $limit
* @param string|null $searchText
* @return \Shopsys\FrameworkBundle\Model\Product\Search\FilterQuery
* @deprecated This method will be removed in next major version. Use \Shopsys\FrameworkBundle\Model\Product\Search\ProductFilterQueryFactory::createListableProductsBySearchText() instead.
* @deprecated This method will be removed in next major version. Use \Shopsys\FrameworkBundle\Model\Product\Search\FilterQueryFactory::createListableProductsBySearchText() instead.
*/
protected function createListableProductsForSearchTextFilterQuery(
ProductFilterData $productFilterData,
Expand All @@ -387,7 +387,7 @@ protected function createListableProductsForSearchTextFilterQuery(
* @param int $page
* @param int $limit
* @return \Shopsys\FrameworkBundle\Model\Product\Search\FilterQuery
* @deprecated This method will be removed in next major version. Use \Shopsys\FrameworkBundle\Model\Product\Search\ProductFilterQueryFactory::createWithProductFilterData() instead.
* @deprecated This method will be removed in next major version. Use \Shopsys\FrameworkBundle\Model\Product\Search\FilterQueryFactory::createWithProductFilterData() instead.
*/
protected function createFilterQueryWithProductFilterData(
ProductFilterData $productFilterData,
Expand All @@ -405,7 +405,7 @@ protected function createFilterQueryWithProductFilterData(

/**
* @return string
* @deprecated This method will be removed in next major version. Use \Shopsys\FrameworkBundle\Model\Product\Search\ProductFilterQueryFactory::getIndexName() instead.
* @deprecated This method will be removed in next major version. Use \Shopsys\FrameworkBundle\Model\Product\Search\FilterQueryFactory::getIndexName() instead.
*/
protected function getIndexName(): string
{
Expand Down
3 changes: 3 additions & 0 deletions packages/framework/src/Resources/translations/messages.cs.po
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,9 @@ msgstr "Vyberte produkt"
msgid "Chosen payment name"
msgstr "Název zvolené platby"

msgid "Choose replacement"
msgstr "Vyberte náhradu"

msgid "Chosen shipping name"
msgstr "Název zvolené dopravy"

Expand Down
3 changes: 3 additions & 0 deletions packages/framework/src/Resources/translations/messages.en.po
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,9 @@ msgstr ""
msgid "Chosen payment name"
msgstr ""

msgid "Choose replacement"
msgstr ""

msgid "Chosen shipping name"
msgstr ""

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="window-content__in">
<div class="window-content__heading">
<h1 class="wrap-bar__heading">{{ 'Delete status of order'|trans }}</h1>
<h1 class="wrap-bar__heading">{{ 'Choose replacement'|trans }}</h1>
</div>
{% if possibleReplacements|length > 0 %}
{{ message|nl2br }}
Expand Down
24 changes: 14 additions & 10 deletions packages/framework/tests/Unit/Model/Security/AuthenticatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@

use PHPUnit\Framework\TestCase;
use Shopsys\FrameworkBundle\Model\Security\Authenticator;
use Shopsys\FrameworkBundle\Model\Security\Exception\LoginFailedException;
use stdClass;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation\ParameterBag;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;

class AuthenticatorTest extends TestCase
Expand All @@ -15,51 +19,51 @@ public function testCheckLoginProcessWithRequestError()
$authenticator = $this->getAuthenticator();

/** @var \Symfony\Component\HttpFoundation\Request|\PHPUnit\Framework\MockObject\MockObject $requestMock */
$requestMock = $this->createMock('\Symfony\Component\HttpFoundation\Request');
$requestMock = $this->createMock(Request::class);

$requestMock->expects($this->never())->method('getSession');

$requestMock->attributes = $this->createMock('\Symfony\Component\HttpFoundation\ParameterBag');
$requestMock->attributes = $this->createMock(ParameterBag::class);
$requestMock->attributes->expects($this->once())->method('has')->willReturn(true);
$requestMock->attributes->expects($this->once())->method('get')->willReturn(new stdClass());

$this->expectException('Shopsys\FrameworkBundle\Model\Security\Exception\LoginFailedException');
$this->expectException(LoginFailedException::class);
$authenticator->checkLoginProcess($requestMock);
}

public function testCheckLoginProcessWithSessionError()
{
$authenticator = $this->getAuthenticator();

$sessionMock = $this->createMock('\Symfony\Component\HttpFoundation\Session\SessionInterface');
$sessionMock = $this->createMock(SessionInterface::class);
$sessionMock->expects($this->atLeastOnce())->method('get')->willReturn(new stdClass());
$sessionMock->expects($this->atLeastOnce())->method('remove');

/** @var \Symfony\Component\HttpFoundation\Request|\PHPUnit\Framework\MockObject\MockObject $requestMock */
$requestMock = $this->createMock('\Symfony\Component\HttpFoundation\Request');
$requestMock = $this->createMock(Request::class);
$requestMock->expects($this->once())->method('getSession')->willReturn($sessionMock);

$requestMock->attributes = $this->createMock('\Symfony\Component\HttpFoundation\ParameterBag');
$requestMock->attributes = $this->createMock(ParameterBag::class);
$requestMock->attributes->expects($this->once())->method('has')->willReturn(false);
$requestMock->attributes->expects($this->never())->method('get');

$this->expectException('Shopsys\FrameworkBundle\Model\Security\Exception\LoginFailedException');
$this->expectException(LoginFailedException::class);
$authenticator->checkLoginProcess($requestMock);
}

public function testCheckLoginProcessWithoutSessionError()
{
$authenticator = $this->getAuthenticator();

$sessionMock = $this->createMock('\Symfony\Component\HttpFoundation\Session\SessionInterface');
$sessionMock = $this->createMock(SessionInterface::class);
$sessionMock->expects($this->once())->method('get')->willReturn(null);
$sessionMock->expects($this->once())->method('remove');

/** @var \Symfony\Component\HttpFoundation\Request|\PHPUnit\Framework\MockObject\MockObject $requestMock */
$requestMock = $this->createMock('\Symfony\Component\HttpFoundation\Request');
$requestMock = $this->createMock(Request::class);
$requestMock->expects($this->once())->method('getSession')->willReturn($sessionMock);

$requestMock->attributes = $this->createMock('\Symfony\Component\HttpFoundation\ParameterBag');
$requestMock->attributes = $this->createMock(ParameterBag::class);
$requestMock->attributes->expects($this->once())->method('has')->willReturn(false);
$requestMock->attributes->expects($this->never())->method('get');

Expand Down
2 changes: 1 addition & 1 deletion project-base/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"ext-xml": "*",
"arvenil/ninja-mutex": "^0.4.1",
"commerceguys/intl": "^1.0.0",
"composer/composer": "^1.6.0",
"composer/composer": "^1.10.22",
"craue/formflow-bundle": "^3.0.3",
"doctrine/annotations": "^1.6.0",
"doctrine/common": "^2.8.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use App\DataFixtures\Demo\AdministratorDataFixture;
use DateTime;
use Shopsys\FrameworkBundle\Model\Administrator\Security\Exception\InvalidTokenException;
use Tests\App\Test\TransactionFunctionalTestCase;
use Zalas\Injector\PHPUnit\Symfony\TestCase\SymfonyTestContainer;

Expand Down Expand Up @@ -55,9 +56,7 @@ public function testGetByValidMultidomainLoginTokenInvalidTokenException()
);
$this->em->flush($administrator);

$this->expectException(
'\Shopsys\FrameworkBundle\Model\Administrator\Security\Exception\InvalidTokenException'
);
$this->expectException(InvalidTokenException::class);

$this->administratorRepository->getByValidMultidomainLoginToken($invalidMultidomainLoginToken);
}
Expand All @@ -76,9 +75,7 @@ public function testGetByValidMultidomainLoginTokenExpiredTokenException()
);
$this->em->flush($administrator);

$this->expectException(
'\Shopsys\FrameworkBundle\Model\Administrator\Security\Exception\InvalidTokenException'
);
$this->expectException(InvalidTokenException::class);

$this->administratorRepository->getByValidMultidomainLoginToken($validMultidomainLoginToken);
}
Expand Down
13 changes: 8 additions & 5 deletions project-base/tests/App/Functional/Model/Cart/CartFacadeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@
use App\DataFixtures\Demo\ProductDataFixture;
use Shopsys\FrameworkBundle\Component\Money\Money;
use Shopsys\FrameworkBundle\Model\Cart\CartFacade;
use Shopsys\FrameworkBundle\Model\Cart\Exception\InvalidCartItemException;
use Shopsys\FrameworkBundle\Model\Cart\Exception\InvalidQuantityException;
use Shopsys\FrameworkBundle\Model\Customer\User\CustomerUserIdentifier;
use Shopsys\FrameworkBundle\Model\Customer\User\CustomerUserIdentifierFactory;
use Shopsys\FrameworkBundle\Model\Product\Exception\ProductNotFoundException;
use Tests\App\Test\TransactionFunctionalTestCase;
use Zalas\Injector\PHPUnit\Symfony\TestCase\SymfonyTestContainer;

Expand Down Expand Up @@ -109,7 +112,7 @@ public function testCannotAddUnsellableProductToCart()
$customerUserIdentifier = new CustomerUserIdentifier('secretSessionHash');
$cartFacade = $this->createCartFacade($customerUserIdentifier);

$this->expectException('\Shopsys\FrameworkBundle\Model\Product\Exception\ProductNotFoundException');
$this->expectException(ProductNotFoundException::class);
$cartFacade->addProductToCart($productId, $quantity);

$cart = $this->getCartByCustomerUserIdentifier($customerUserIdentifier);
Expand Down Expand Up @@ -163,7 +166,7 @@ public function testCannotDeleteNonexistentCartItem()
$cartItems = $cart->getItems();
$cartItem = array_pop($cartItems);

$this->expectException('\Shopsys\FrameworkBundle\Model\Cart\Exception\InvalidCartItemException');
$this->expectException(InvalidCartItemException::class);
$cartFacade->deleteCartItem($cartItem->getId() + 1);
}

Expand Down Expand Up @@ -308,7 +311,7 @@ public function testCannotAddProductFloatQuantityToCart()
{
$product = $this->createProduct();

$this->expectException('Shopsys\FrameworkBundle\Model\Cart\Exception\InvalidQuantityException');
$this->expectException(InvalidQuantityException::class);

/** @phpstan-ignore-next-line */
$this->cartFacadeFromContainer->addProductToCart($product->getId(), 1.1);
Expand All @@ -318,15 +321,15 @@ public function testCannotAddProductZeroQuantityToCart()
{
$product = $this->createProduct();

$this->expectException('Shopsys\FrameworkBundle\Model\Cart\Exception\InvalidQuantityException');
$this->expectException(InvalidQuantityException::class);
$this->cartFacadeFromContainer->addProductToCart($product->getId(), 0);
}

public function testCannotAddProductNegativeQuantityToCart()
{
$product = $this->createProduct();

$this->expectException('Shopsys\FrameworkBundle\Model\Cart\Exception\InvalidQuantityException');
$this->expectException(InvalidQuantityException::class);
$this->cartFacadeFromContainer->addProductToCart($product->getId(), -10);
}

Expand Down
10 changes: 5 additions & 5 deletions upgrade/UPGRADE-v9.0.3.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ There you can find links to upgrade notes for other versions too.

- ProductOnCurrentDomainElasticFacade has been refactored ([#2036](https://github.com/shopsys/shopsys/pull/2036))
- these methods are now deprecated:
- `ProductOnCurrentDomainElasticFacade::createListableProductsInCategoryFilterQuery()` use `ProductFilterQueryFactory::createListableProductsByCategoryId()` instead
- `ProductOnCurrentDomainElasticFacade::createListableProductsForBrandFilterQuery()` use `ProductFilterQueryFactory::createListableProductsByBrandId()` instead
- `ProductOnCurrentDomainElasticFacade::createListableProductsForSearchTextFilterQuery()` use `ProductFilterQueryFactory::createListableProductsBySearchText()` instead
- `ProductOnCurrentDomainElasticFacade::createFilterQueryWithProductFilterData()` use `ProductFilterQueryFactory::createWithProductFilterData()` instead
- `ProductOnCurrentDomainElasticFacade::getIndexName()` use `ProductFilterQueryFactory::getIndexName()` instead
- `ProductOnCurrentDomainElasticFacade::createListableProductsInCategoryFilterQuery()` use `FilterQueryFactory::createListableProductsByCategoryId()` instead
- `ProductOnCurrentDomainElasticFacade::createListableProductsForBrandFilterQuery()` use `FilterQueryFactory::createListableProductsByBrandId()` instead
- `ProductOnCurrentDomainElasticFacade::createListableProductsForSearchTextFilterQuery()` use `FilterQueryFactory::createListableProductsBySearchText()` instead
- `ProductOnCurrentDomainElasticFacade::createFilterQueryWithProductFilterData()` use `FilterQueryFactory::createWithProductFilterData()` instead
- `ProductOnCurrentDomainElasticFacade::getIndexName()` use `FilterQueryFactory::getIndexName()` instead

- remove FE API only dependencies from framework ([#2041](https://github.com/shopsys/shopsys/pull/2041))
- these methods have been marked as deprecated and will be removed in next major version:
Expand Down
11 changes: 11 additions & 0 deletions upgrade/UPGRADE-v9.1.2-dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,14 @@ This guide contains instructions to upgrade from version v9.1.1 to v9.1.2-dev.

**Before you start, don't forget to take a look at [general instructions](https://github.com/shopsys/shopsys/blob/7.3/UPGRADE.md) about upgrading.**
There you can find links to upgrade notes for other versions too.

- potential **BC break** ([#2300](https://github.com/shopsys/shopsys/pull/2300))
- method `Shopsys\FrameworkBundle\Form\Admin\Customer\User\CustomerUserFormType::validateUniqueEmail()` has changed its interface
- first argument `$email` was changed to accept `null` or `string` instead of `string` only

- replace class names defined by FQCN string by `*::class` constant ([#2319](https://github.com/shopsys/shopsys/pull/2300))
- see #project-base-diff to update your project

- update composer dependency `composer/composer` in your project ([#2313](https://github.com/shopsys/shopsys/pull/2313))
- versions bellow `1.10.22` has [reported security issue](https://github.com/composer/composer/security/advisories/GHSA-h5h8-pc6h-jvvx)
- see #project-base-diff to update your project

0 comments on commit 84a6f85

Please sign in to comment.