Skip to content

Commit

Permalink
New Testing format like #27500
Browse files Browse the repository at this point in the history
  • Loading branch information
Jack Krielen committed Apr 16, 2020
1 parent cfb762d commit c6a43f3
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,79 +15,79 @@
class ConfigurableTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Catalog\Block\Product\Context|\PHPUnit_Framework_MockObject_MockObject
* @var \Magento\Catalog\Block\Product\Context|\PHPUnit\Framework\MockObject\MockObject
*/
private $context;

/**
* @var \Magento\Framework\Stdlib\ArrayUtils|\PHPUnit_Framework_MockObject_MockObject
* @var \Magento\Framework\Stdlib\ArrayUtils|\PHPUnit\Framework\MockObject\MockObject
*/
private $arrayUtils;

/**
* @var \Magento\Framework\Json\EncoderInterface|\PHPUnit_Framework_MockObject_MockObject
* @var \Magento\Framework\Json\EncoderInterface|\PHPUnit\Framework\MockObject\MockObject
*/
private $jsonEncoder;

/**
* @var \Magento\ConfigurableProduct\Helper\Data|\PHPUnit_Framework_MockObject_MockObject
* @var \Magento\ConfigurableProduct\Helper\Data|\PHPUnit\Framework\MockObject\MockObject
*/
private $helper;

/**
* @var \Magento\Catalog\Helper\Product|\PHPUnit_Framework_MockObject_MockObject
* @var \Magento\Catalog\Helper\Product|\PHPUnit\Framework\MockObject\MockObject
*/
private $product;

/**
* @var \Magento\Customer\Helper\Session\CurrentCustomer|\PHPUnit_Framework_MockObject_MockObject
* @var \Magento\Customer\Helper\Session\CurrentCustomer|\PHPUnit\Framework\MockObject\MockObject
*/
private $currentCustomer;

/**
* @var \Magento\Framework\Pricing\PriceCurrencyInterface|\PHPUnit_Framework_MockObject_MockObject
* @var \Magento\Framework\Pricing\PriceCurrencyInterface|\PHPUnit\Framework\MockObject\MockObject
*/
private $priceCurrency;

/**
* @var \Magento\Directory\Model\Currency|\PHPUnit_Framework_MockObject_MockObject
* @var \Magento\Directory\Model\Currency|\PHPUnit\Framework\MockObject\MockObject
*/
private $currency;

/**
* @var \Magento\ConfigurableProduct\Model\ConfigurableAttributeData|\PHPUnit_Framework_MockObject_MockObject
* @var \Magento\ConfigurableProduct\Model\ConfigurableAttributeData|\PHPUnit\Framework\MockObject\MockObject
*/
private $configurableAttributeData;

/**
* @var \Magento\Framework\Locale\Format|\PHPUnit_Framework_MockObject_MockObject
* @var \Magento\Framework\Locale\Format|\PHPUnit\Framework\MockObject\MockObject
*/
private $localeFormat;

/**
* @var \Magento\ConfigurableProduct\Block\Product\View\Type\Configurable|\PHPUnit_Framework_MockObject_MockObject
* @var \Magento\ConfigurableProduct\Block\Product\View\Type\Configurable|\PHPUnit\Framework\MockObject\MockObject
*/
private $block;

/**
* @var \Magento\Store\Model\StoreManagerInterface|\PHPUnit_Framework_MockObject_MockObject
* @var \Magento\Store\Model\StoreManagerInterface|\PHPUnit\Framework\MockObject\MockObject
*/
private $storeManager;

/**
* @var \PHPUnit_Framework_MockObject_MockObject
* @var \PHPUnit\Framework\MockObject\MockObject
*/
private $customerSession;

/**
* @var \PHPUnit_Framework_MockObject_MockObject
* @var \PHPUnit\Framework\MockObject\MockObject
*/
private $variationPricesMock;

/**
* {@inheritDoc}
*/
protected function setUp()
protected function setUp(): void
{
$this->mockContextObject();

Expand Down Expand Up @@ -230,7 +230,7 @@ public function cacheKeyProvider(): array
* @param string|null $priceCurrency
* @param string|null $customerGroupId
*/
public function testGetCacheKeyInfo(array $expected, string $priceCurrency = null, string $customerGroupId = null)
public function testGetCacheKeyInfo(array $expected, string $priceCurrency = null, string $customerGroupId = null): void
{
$storeMock = $this->getMockBuilder(\Magento\Store\Api\Data\StoreInterface::class)
->setMethods(['getCurrentCurrency'])
Expand Down Expand Up @@ -258,7 +258,7 @@ public function testGetCacheKeyInfo(array $expected, string $priceCurrency = nul
/**
* Check that getJsonConfig() method returns expected value
*/
public function testGetJsonConfig()
public function testGetJsonConfig(): void
{
$productId = 1;
$amount = 10.50;
Expand Down Expand Up @@ -416,10 +416,10 @@ private function getExpectedArray($productId, $amount, $priceQty, $percentage):
/**
* Retrieve mocks of \Magento\ConfigurableProduct\Model\Product\Type\Configurable object
*
* @param \PHPUnit_Framework_MockObject_MockObject $productMock
* @return \PHPUnit_Framework_MockObject_MockObject
* @param \PHPUnit\Framework\MockObject\MockObject $productMock
* @return \PHPUnit\Framework\MockObject\MockObject
*/
private function getProductTypeMock(\PHPUnit_Framework_MockObject_MockObject $productMock)
private function getProductTypeMock(\PHPUnit\Framework\MockObject\MockObject $productMock): \PHPUnit\Framework\MockObject\MockObject
{
$currencyMock = $this->getMockBuilder(\Magento\Directory\Model\Currency::class)
->disableOriginalConstructor()
Expand Down Expand Up @@ -459,7 +459,7 @@ private function getProductTypeMock(\PHPUnit_Framework_MockObject_MockObject $pr
*
* @return void
*/
protected function mockContextObject()
protected function mockContextObject(): void
{
$this->storeManager = $this->getMockBuilder(\Magento\Store\Model\StoreManagerInterface::class)
->getMockForAbstractClass();
Expand All @@ -476,9 +476,9 @@ protected function mockContextObject()
* Retrieve mock of \Magento\Framework\Pricing\Amount\AmountInterface object
*
* @param float $amount
* @return \PHPUnit_Framework_MockObject_MockObject
* @return \Magento\Framework\Pricing\Amount\AmountInterface|\PHPUnit\Framework\MockObject\MockObject
*/
protected function getAmountMock($amount): \PHPUnit_Framework_MockObject_MockObject
protected function getAmountMock($amount): \PHPUnit\Framework\MockObject\MockObject
{
$amountMock = $this->getMockBuilder(\Magento\Framework\Pricing\Amount\AmountInterface::class)
->setMethods(['getValue', 'getBaseAmount'])
Expand All @@ -496,12 +496,12 @@ protected function getAmountMock($amount): \PHPUnit_Framework_MockObject_MockObj
/**
* Retrieve mock of \Magento\Catalog\Pricing\Price\TierPriceInterface object
*
* @param \PHPUnit_Framework_MockObject_MockObject $amountMock
* @param \PHPUnit\Framework\MockObject\MockObject $amountMock
* @param float $priceQty
* @param int $percentage
* @return \PHPUnit_Framework_MockObject_MockObject
* @return \PHPUnit\Framework\MockObject\MockObject
*/
protected function getTierPriceMock(\PHPUnit_Framework_MockObject_MockObject $amountMock, $priceQty, $percentage)
protected function getTierPriceMock(\PHPUnit_Framework_MockObject_MockObject $amountMock, $priceQty, $percentage): \PHPUnit\Framework\MockObject\MockObject
{
$tierPrice = [
'price_qty' => $priceQty,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
class PricesTest extends TestCase
{
/**
* @var \PHPUnit_Framework_MockObject_MockObject
* @var \PHPUnit\Framework\MockObject\MockObject
*/
private $localeFormatMock;

Expand All @@ -22,15 +22,15 @@ class PricesTest extends TestCase
*/
private $model;

protected function setUp()
protected function setUp(): void
{
$this->localeFormatMock = $this->createMock(\Magento\Framework\Locale\Format::class);
$this->model = new \Magento\ConfigurableProduct\Model\Product\Type\Configurable\Variations\Prices(
$this->localeFormatMock
);
}

public function testGetFormattedPrices()
public function testGetFormattedPrices(): void
{
$expected = [
'baseOldPrice' => [
Expand Down

0 comments on commit c6a43f3

Please sign in to comment.