-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #94 from Paazl/release/1.12.0
Release/1.12.0
- Loading branch information
Showing
16 changed files
with
340 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,33 @@ | ||
name: setup:di:compile | ||
name: Run setup:upgrade and setup:di:compile | ||
on: [pull_request] | ||
|
||
jobs: | ||
build: | ||
strategy: | ||
matrix: | ||
include: | ||
- PHP_VERSION: php72-fpm | ||
MAGENTO_VERSION: 2.3.3 | ||
- PHP_VERSION: php73-fpm | ||
MAGENTO_VERSION: 2.3.6-p1 | ||
- PHP_VERSION: php74-fpm | ||
MAGENTO_VERSION: 2.4.2 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
build: | ||
strategy: | ||
matrix: | ||
include: | ||
- PHP_VERSION: php71-fpm | ||
MAGENTO_VERSION: 2.3.3 | ||
- PHP_VERSION: php73-fpm | ||
MAGENTO_VERSION: 2.3.7 | ||
- PHP_VERSION: php74-fpm | ||
MAGENTO_VERSION: 2.4.0 | ||
- PHP_VERSION: php74-fpm | ||
MAGENTO_VERSION: 2.4.3-with-replacements | ||
- PHP_VERSION: php81-fpm | ||
MAGENTO_VERSION: 2.4.4 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Start Docker | ||
run: docker run --detach --name magento-project-community-edition michielgerritsen/magento-project-community-edition:${{ matrix.PHP_VERSION }}-magento${{ matrix.MAGENTO_VERSION }} | ||
- name: Start Docker | ||
run: PHP_VERSION=${{ matrix.PHP_VERSION }} MAGENTO_VERSION=magento${{ matrix.MAGENTO_VERSION }} docker-compose -f .github/workflows/templates/docker-compose.yml up -d | ||
|
||
- name: Create branch for Composer and remove version from composer.json | ||
run: git checkout -b continuous-integration-test-branch && sed -i '/version/d' ./composer.json | ||
- name: Create branch for Composer and remove version from composer.json | ||
run: git checkout -b continuous-integration-test-branch && sed -i '/version/d' ./composer.json | ||
|
||
- name: Upload our code into the docker container | ||
run: docker cp $(pwd) magento-project-community-edition:/data/extensions/ | ||
- name: Upload the code into the docker container | ||
run: docker cp $(pwd) magento-project-community-edition:/data/extensions/ && docker exec magento-project-community-edition composer require paazl/magento2-checkout-widget:dev-continuous-integration-test-branch | ||
|
||
- name: Install the extension in Magento | ||
run: docker exec magento-project-community-edition composer require paazl/magento2-checkout-widget:dev-continuous-integration-test-branch | ||
|
||
- name: Run setup:di:compile | ||
run: docker exec magento-project-community-edition php bin/magento setup:di:compile | ||
- name: Activate the extension and run setup:upgrade and setup:di:compile | ||
run: docker exec magento-project-community-edition bash -c "php bin/magento module:enable Paazl_CheckoutWidget && php bin/magento setup:upgrade && php bin/magento setup:di:compile" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,36 @@ | ||
name: Unit Tests | ||
|
||
on: pull_request | ||
on: [pull_request] | ||
|
||
jobs: | ||
build: | ||
strategy: | ||
matrix: | ||
PHP_VERSION: [php71-fpm, php72-fpm] | ||
MAGENTO_VERSION: [2.2.11, 2.3.4] | ||
exclude: | ||
- PHP_VERSION: php72-fpm | ||
MAGENTO_VERSION: 2.2.11 | ||
include: | ||
- PHP_VERSION: php71-fpm | ||
MAGENTO_VERSION: 2.3.3 | ||
- PHP_VERSION: php73-fpm | ||
MAGENTO_VERSION: 2.3.7 | ||
- PHP_VERSION: php74-fpm | ||
MAGENTO_VERSION: 2.4.0 | ||
- PHP_VERSION: php74-fpm | ||
MAGENTO_VERSION: 2.4.3-with-replacements | ||
- PHP_VERSION: php81-fpm | ||
MAGENTO_VERSION: 2.4.4 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Start Docker | ||
run: PHP_VERSION=${{ matrix.PHP_VERSION }} MAGENTO_VERSION=magento${{ matrix.MAGENTO_VERSION }} docker-compose -f .github/workflows/templates/docker-compose.yml up -d | ||
run: docker run --detach --name magento-project-community-edition michielgerritsen/magento-project-community-edition:${{ matrix.PHP_VERSION }}-magento${{ matrix.MAGENTO_VERSION }} | ||
|
||
- name: Create branch for Composer and remove version from composer.json | ||
run: git checkout -b continuous-integration-test-branch && sed -i '/version/d' ./composer.json | ||
|
||
- name: Upload the code into the docker container | ||
run: docker cp $(pwd) magento-project-community-edition:/data/extensions/ && docker exec magento-project-community-edition composer require paazl/magento2-checkout-widget:dev-continuous-integration-test-branch | ||
|
||
- name: Upload our code into the docker container | ||
run: docker cp $(pwd)/. magento-project-community-edition:/data/extensions/workdir && docker exec magento-project-community-edition composer require paazl/magento2-checkout-widget:@dev | ||
- name: Activate the extension and run setup:upgrade | ||
run: docker exec magento-project-community-edition bash -c "php bin/magento module:enable Paazl_CheckoutWidget && php bin/magento setup:upgrade" | ||
|
||
- name: Run tests | ||
run: docker exec magento-project-community-edition bash -c "vendor/bin/phpunit extensions/workdir/Test/Unit" | ||
run: docker exec magento-project-community-edition bash -c "vendor/bin/phpunit extensions/*/Test/Unit" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
/* | ||
* Copyright © Paazl. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
namespace Magento\Framework\GraphQl\Query; | ||
|
||
/** | ||
* This class is available in default Magento 2.3.3 versions and higher. But due to Composer replace techniques, this | ||
* class is sometimes missing. So check if it's available, and if not, create an empty variant. It's then only used | ||
* for class generation in the setup:di:compile process. | ||
*/ | ||
if (!interface_exists(ResolverInterface::class)) { | ||
interface ResolverInterface | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<?php | ||
/* | ||
* Copyright © Paazl. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
namespace Paazl\CheckoutWidget\GraphQL\Resolver; | ||
|
||
use Magento\Framework\GraphQl\Config\Element\Field; | ||
use Magento\Framework\GraphQl\Exception\GraphQlInputException; | ||
use Magento\Framework\GraphQl\Query\ResolverInterface; | ||
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo; | ||
use Magento\Quote\Api\CartRepositoryInterface; | ||
use Magento\Quote\Api\Data\CartInterface; | ||
use Magento\Quote\Model\Quote; | ||
use Magento\Quote\Model\QuoteIdMaskFactory; | ||
use Magento\Quote\Model\ResourceModel\Quote\QuoteIdMask as QuoteIdMaskResource; | ||
use Paazl\CheckoutWidget\Model\Checkout\WidgetConfigProvider; | ||
|
||
class ConfigurationResolver implements ResolverInterface | ||
{ | ||
/** | ||
* @var WidgetConfigProvider | ||
*/ | ||
private $widgetConfigProvider; | ||
|
||
/** | ||
* @var CartRepositoryInterface | ||
*/ | ||
private $cartRepository; | ||
|
||
/** | ||
* @var QuoteIdMaskFactory | ||
*/ | ||
private $quoteIdMaskFactory; | ||
|
||
/** | ||
* @var QuoteIdMaskResource | ||
*/ | ||
private $quoteIdMaskResource; | ||
|
||
public function __construct( | ||
WidgetConfigProvider $widgetConfigProvider, | ||
CartRepositoryInterface $cartRepository, | ||
QuoteIdMaskFactory $quoteIdMaskFactory, | ||
QuoteIdMaskResource $quoteIdMaskResource | ||
) { | ||
$this->widgetConfigProvider = $widgetConfigProvider; | ||
$this->cartRepository = $cartRepository; | ||
$this->quoteIdMaskFactory = $quoteIdMaskFactory; | ||
$this->quoteIdMaskResource = $quoteIdMaskResource; | ||
} | ||
|
||
public function resolve(Field $field, $context, ResolveInfo $info, array $value = null, array $args = null) | ||
{ | ||
if (!isset($args['cart_id']) || empty($args['cart_id'])) { | ||
throw new GraphQlInputException(__('"cart_id" is required')); | ||
} | ||
|
||
$quoteIdMask = $this->quoteIdMaskFactory->create(); | ||
$this->quoteIdMaskResource->load($quoteIdMask, $args['cart_id'], 'masked_id'); | ||
|
||
/** @var CartInterface|Quote $cart */ | ||
$cart = $this->cartRepository->get($quoteIdMask->getQuoteId()); | ||
|
||
$this->widgetConfigProvider->setQuote($cart); | ||
return $this->widgetConfigProvider->getConfig(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
// phpcs:disable Generic.Classes.DuplicateClassName.Found | ||
/** | ||
* Copyright © Paazl. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
namespace Paazl\CheckoutWidget\Test\Unit; | ||
|
||
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
class UnitTestCase extends TestCase | ||
{ | ||
/** | ||
* @var ObjectManager | ||
*/ | ||
protected $objectManager; | ||
|
||
protected function setUp() | ||
{ | ||
parent::setUp(); | ||
|
||
$this->objectManager = new ObjectManager($this); | ||
$this->setUpWithoutVoid(); | ||
} | ||
|
||
protected function setUpWithoutVoid() | ||
{ | ||
} | ||
} |
Oops, something went wrong.