Skip to content

Commit

Permalink
Merge pull request #185 from firegento/develop
Browse files Browse the repository at this point in the history
Merge develop into master
  • Loading branch information
sprankhub authored Oct 8, 2020
2 parents 09d855f + 1c6b38a commit 559ca8d
Show file tree
Hide file tree
Showing 15 changed files with 223 additions and 130 deletions.
39 changes: 20 additions & 19 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,34 @@
sudo: required
dist: trusty
addons:
apt:
packages:
- mysql-server-5.6
- mysql-client-core-5.6
- mysql-client-5.6
dist: bionic
services:
- mysql
- elasticsearch
env:
global:
- COVERAGE: false

matrix:
jobs:
fast_finish: true
include:
# make sure it is running on the oldest supported version
- php: 7.2
env: MAGENTO_VERSION=2.3.0
# fix the code quality check to a specific, but rather new version
# fix the code quality check to a specific version
- php: 7.2
env: MAGENTO_VERSION=2.3.5-p1 CODE_QUALITY=true
# make sure it is running on the latest version
# make sure it is running on the oldest and latest version for each release line
- php: 7.2
env: MAGENTO_VERSION=2.3.1 INTEGRATION_TEST=true
env: MAGENTO_VERSION=2.3.0
- php: 7.2
env: MAGENTO_VERSION=2.3.* INTEGRATION_TEST=true
env: MAGENTO_VERSION=2.3.*
- php: 7.3
env: MAGENTO_VERSION=2.3.3
- php: 7.3
env: MAGENTO_VERSION=2.3.*
- php: 7.3
env: MAGENTO_VERSION=2.3.3 INTEGRATION_TEST=true
env: MAGENTO_VERSION=2.4.0 UNIT_TEST=true INTEGRATION_TEST=true
- php: 7.3
env: MAGENTO_VERSION=2.3.* INTEGRATION_TEST=true
env: MAGENTO_VERSION=2.4.* UNIT_TEST=true INTEGRATION_TEST=true
- php: 7.4
env: MAGENTO_VERSION=2.4.0 UNIT_TEST=true INTEGRATION_TEST=true
- php: 7.4
env: MAGENTO_VERSION=2.4.* UNIT_TEST=true INTEGRATION_TEST=true


language: php
Expand All @@ -43,7 +44,7 @@ before_install:
- "./Test/script/travis_before_install.sh"

install:
- echo "{\"http-basic\":{\"repo.magento.com\":{\"username\":\"${MAGENTO_USERNAME}\",\"password\":\"${MAGENTO_PASSWORD}\"}}}" > $HOME/.composer/auth.json
- composer config -g http-basic.repo.magento.com "$MAGENTO_USERNAME" "$MAGENTO_PASSWORD"
- export MAGENTO_ROOT=`mktemp -d /tmp/mage.XXXXXXXX`
- "./Test/script/travis_install_magento.sh $MAGENTO_VERSION"

Expand Down
20 changes: 17 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,24 @@
# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)

## v0.3.0
## [Unreleased]
### Fixed
- ...

### Added
- ...

### Removed
- ...

## [v0.4.0] - 2020-10-08
### Added
- Support for Magento 2.4 (thanks @sprankhub)
- Support for PHP 7.4 (thanks @sprankhub)

## [v0.3.0] - 2020-06-30
### Fixed
- Fix imprint blocks in mails [#149](https://github.com/firegento/firegento-magesetup2/issues/149) (thanks @sprankhub)
- Hide tax details for grouped product [#150](https://github.com/firegento/firegento-magesetup2/issues/150) (thanks @sprankhub)
Expand All @@ -21,7 +36,6 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
- Add integration test to travis ci [#166](https://github.com/firegento/firegento-magesetup2/issues/166) (thanks @frostblogNet)
- Add unit test form blocks (thanks @frostblogNet)
- Add integration test for visible in checkout property (thanks @sprankhub)


### Removed
- Remove price details from tier prices [#87](https://github.com/firegento/firegento-magesetup2/issues/87) (thanks @sprankhub)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ Missing your country? Please open a pull request with the necessary configuratio

Requirements
------------
- PHP >= 7.2
- Magento >= 2.3.*
- PHP >= 7.2
- Magento 2.3.* / 2.4.*

Installation
------------
Expand Down
6 changes: 3 additions & 3 deletions Test/Integration/ModuleConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,20 @@ protected function setUp(): void
public function testTheModuleIsRegistered(): void
{
$registrar = new ComponentRegistrar();
$this->assertArrayHasKey($this->subjectModuleName, $registrar->getPaths(ComponentRegistrar::MODULE));
self::assertArrayHasKey($this->subjectModuleName, $registrar->getPaths(ComponentRegistrar::MODULE));
}

public function testModuleIsListed(): void
{
/** @var ModuleList $moduleList */
$moduleList = $this->objectManager->create(ModuleList::class);
$this->assertTrue($moduleList->has($this->subjectModuleName));
self::assertTrue($moduleList->has($this->subjectModuleName));
}

public function testTheModuleIsConfiguredInTheTestEnvironment(): void
{
/** @var ModuleList $moduleList */
$moduleList = $this->objectManager->create(ModuleList::class);
$this->assertTrue($moduleList->has($this->subjectModuleName));
self::assertTrue($moduleList->has($this->subjectModuleName));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ public function testExecute()
$attribute = $productAttributeRepository->get('name');
$this->getRequest()->setParam('attribute_id', $attribute->getAttributeId());
$this->dispatch($this->uri);
$this->assertContains('Visible in Checkout', $this->getResponse()->getBody());
self::assertStringContainsString('Visible in Checkout', $this->getResponse()->getBody());
}
}
16 changes: 8 additions & 8 deletions Test/Unit/Block/Imprint/ContentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ class ContentTest extends TestCase
/** @var ScopeConfigInterface|MockObject */
protected $scopeConfigMock;

public function setUp()
public function setUp(): void
{
parent::setUp(); // TODO: Change the autogenerated stub
parent::setUp();

$this->countryInformationAcquirerMock = $this
->getMockBuilder(CountryInformationAcquirerInterface::class)
Expand Down Expand Up @@ -86,7 +86,7 @@ public function testGetCountry(): void
->method('getCountryInfo')
->willReturn($countryInformationAcquirerInterfaceMock);

$this->assertSame($countryName, $this->sut->getCountry());
self::assertSame($countryName, $this->sut->getCountry());
}

public function testGetWeb(): void
Expand All @@ -97,20 +97,20 @@ public function testGetWeb(): void
->method('getValue')
->willReturn($baseUrl);

$this->assertSame($baseUrl, $this->sut->getWeb());
self::assertSame($baseUrl, $this->sut->getWeb());
}

public function testGetEmail(): void
{
$email = "[email protected]";
# empty email case 1
$this->assertSame('', $this->sut->getEmail());
self::assertSame('', $this->sut->getEmail());
# antispam true
$this->scopeConfigMock
->expects($this->at(0))
->expects(self::at(0))
->method('getValue')
->willReturn($email);
$this->assertSame($email, $this->sut->getEmail(false));
self::assertSame($email, $this->sut->getEmail(false));
$this->scopeConfigMock
->expects($this->at(0))
->method('getValue')
Expand All @@ -119,6 +119,6 @@ public function testGetEmail(): void
$expected = '<a href="#" onclick="toRecipient();">max<span class="no-display">nospamplease'
. '</span>@<span class="no-display">nospamplease</span>muster.de</a><script>function '
. 'toRecipient(){var m = \'max\';m += \'@\';m += \'muster.de\';location.href= "mailto:"+m;}</script>';
$this->assertSame($expected, $this->sut->getEmail(true));
self::assertSame($expected, $this->sut->getEmail(true));
}
}
62 changes: 31 additions & 31 deletions Test/Unit/Block/Price/DetailsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class DetailsTest extends TestCase
/** @var \Magento\Store\Model\StoreManagement|MockObject */
protected $storeManagerMock;

public function setUp()
public function setUp(): void
{
parent::setUp();

Expand All @@ -62,7 +62,7 @@ public function setUp()
$this->contextMock = $this->createMock(Context::class);

$this->contextMock
->expects($this->atLeastOnce())
->expects(self::atLeastOnce())
->method('getStoreManager')
->willReturn($this->storeManagerMock);

Expand Down Expand Up @@ -95,14 +95,14 @@ public function testSetSaleableItem(): void
->disableOriginalConstructor()
->getMockForAbstractClass();
$this->sut->setSaleableItem($saleableItemMock);
$this->assertNull($this->sut->getData('tax_rate'));
self::assertNull($this->sut->getData('tax_rate'));
}

public function testGetFormattedTaxRate(): void
{
$this->sut->setData('tax_rate', '19');
$expected = new Phrase('%1%', ['19']);
$this->assertEquals($expected, $this->sut->getFormattedTaxRate());
self::assertEquals($expected, $this->sut->getFormattedTaxRate());
}

public function testGetFormattedTaxRateIsZero(): void
Expand All @@ -112,13 +112,13 @@ public function testGetFormattedTaxRateIsZero(): void
->disableOriginalConstructor()
->getMockForAbstractClass();
$saleableItemMock
->expects($this->at(0))
->expects(self::at(0))
->method('getTaxPercent')
->willReturn(7);

$this->sut->setSaleableItem($saleableItemMock);
$expected = new Phrase('%1%', ['7']);
$this->assertEquals($expected, $this->sut->getFormattedTaxRate());
self::assertEquals($expected, $this->sut->getFormattedTaxRate());
}

public function testGetFormattedTaxRateIsFive(): void
Expand All @@ -128,12 +128,12 @@ public function testGetFormattedTaxRateIsFive(): void
->disableOriginalConstructor()
->getMockForAbstractClass();
$saleableItem2Mock
->expects($this->at(0))
->expects(self::at(0))
->method('getTaxPercent')
->willReturn(null);

$saleableItem2Mock
->expects($this->at(1))
->expects(self::at(1))
->method('getTaxClassId')
->willReturn('simple');

Expand All @@ -142,81 +142,81 @@ public function testGetFormattedTaxRateIsFive(): void
->getMockForAbstractClass();

$this->storeManagerMock
->expects($this->at(0))
->expects(self::at(0))
->method('getStore')
->willReturn($storeMock);

$this->customerSessionMock
->expects($this->at(0))
->expects(self::at(0))
->method('getCustomerGroupId')
->willReturn(10);
$groupMock = $this->createMock(\Magento\Customer\Model\Data\Group::class);

$groupMock
->expects($this->at(0))
->expects(self::at(0))
->method('getTaxClassId')
->willReturn(20);

$this->groupRepositoryMock
->expects($this->at(0))
->expects(self::at(0))
->method('getById')
->withAnyParameters(10)
->willReturn($groupMock);

$dataMock = $this->createMock(\Magento\Framework\DataObject::class);

$dataMock
->expects($this->at(0))
->expects(self::at(0))
->method('setData')
->willReturn($dataMock);

$this->taxCalculationMock
->expects($this->at(0))
->expects(self::at(0))
->method('getRateRequest')
->willReturn($dataMock);

$this->taxCalculationMock
->expects($this->at(1))
->expects(self::at(1))
->method('getRate')
->willReturn(5);

$this->sut->setSaleableItem($saleableItem2Mock);
$expected = new Phrase('%1%', ['5']);
$this->assertEquals($expected, $this->sut->getFormattedTaxRate());
self::assertEquals($expected, $this->sut->getFormattedTaxRate());
}

public function testGetPriceDisplayType(): void
{
$this->taxHelperMock
->expects($this->at(0))
->expects(self::at(0))
->method('getPriceDisplayType')
->willReturn(4);
$this->assertSame(4, $this->sut->getPriceDisplayType());
self::assertSame(4, $this->sut->getPriceDisplayType());
}

public function testIsIncludingShippingCosts(): void
{
$this->assertFalse($this->sut->isIncludingShippingCosts());
self::assertFalse($this->sut->isIncludingShippingCosts());

$this->sut->setData('is_including_shipping_costs', null);
$this->assertFalse($this->sut->isIncludingShippingCosts());
self::assertFalse($this->sut->isIncludingShippingCosts());

$this->sut->setData('is_including_shipping_costs', 1);
$this->assertTrue($this->sut->isIncludingShippingCosts());
self::assertTrue($this->sut->isIncludingShippingCosts());

$this->sut->unsetData('is_including_shipping_costs');
$this->magesetupConfigMock
->expects($this->at(0))
->expects(self::at(0))
->method('isIncludingShippingCosts')
->willReturn(false);
$this->assertFalse($this->sut->isIncludingShippingCosts());
self::assertFalse($this->sut->isIncludingShippingCosts());

$this->sut->unsetData('is_including_shipping_costs');
$this->magesetupConfigMock
->expects($this->at(0))
->expects(self::at(0))
->method('isIncludingShippingCosts')
->willReturn(true);
$this->assertTrue($this->sut->isIncludingShippingCosts());
self::assertTrue($this->sut->isIncludingShippingCosts());
}

public function testCanShowShippingLink(): void
Expand All @@ -226,29 +226,29 @@ public function testCanShowShippingLink(): void
->disableOriginalConstructor()
->getMockForAbstractClass();
$saleableItemMock
->expects($this->at(0))
->expects(self::at(0))
->method('getTypeId')
->willReturn('virtual');

$this->sut->setSaleableItem($saleableItemMock);
$this->assertFalse($this->sut->canShowShippingLink());
self::assertFalse($this->sut->canShowShippingLink());

$saleableItemMock
->expects($this->at(0))
->expects(self::at(0))
->method('getTypeId')
->willReturn('configurable');

$this->sut->setSaleableItem($saleableItemMock);
$this->assertTrue($this->sut->canShowShippingLink());
self::assertTrue($this->sut->canShowShippingLink());
}

public function testGetShippingCostUrl()
{
$shippingCostUrl = "http://shop.firegento.com/shipping";
$this->magesetupConfigMock
->expects($this->at(0))
->expects(self::at(0))
->method('getShippingCostUrl')
->willReturn($shippingCostUrl);
$this->assertSame($shippingCostUrl, $this->sut->getShippingCostUrl());
self::assertSame($shippingCostUrl, $this->sut->getShippingCostUrl());
}
}
Loading

0 comments on commit 559ca8d

Please sign in to comment.