Skip to content

Commit

Permalink
added unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
engcom-Echo committed Aug 7, 2020
1 parent f8a5126 commit da38103
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app/code/Magento/Catalog/Helper/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,9 @@ public function backgroundColor($colorRGB)
{
// assume that 3 params were given instead of array
if (!is_array($colorRGB)) {
//phpcs:disable
$colorRGB = func_get_args();
//phpcs:enabled
}
$this->_getModel()->setBackgroundColor($colorRGB);
return $this;
Expand Down Expand Up @@ -498,7 +500,11 @@ protected function initBaseFile()
if ($this->getImageFile()) {
$model->setBaseFile($this->getImageFile());
} else {
$model->setBaseFile($this->getProduct() ? $this->getProduct()->getData($model->getDestinationSubdir()) : '');
$model->setBaseFile(
$this->getProduct()
? $this->getProduct()->getData($model->getDestinationSubdir())
: ''
);
}
}
return $this;
Expand Down
8 changes: 8 additions & 0 deletions app/code/Magento/Catalog/Test/Unit/Helper/ImageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,14 @@ public function testGetWidth()
$this->assertEquals($data['width'], $this->helper->getWidth());
}

/**
* Check initBaseFile without properties - product
*/
public function testGetUrlWithOutProduct()
{
$this->assertNull($this->helper->getUrl());
}

/**
* @param array $data
* @dataProvider getHeightDataProvider
Expand Down

0 comments on commit da38103

Please sign in to comment.