Skip to content

Commit

Permalink
PRs improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
vlmed committed Mar 24, 2021
1 parent 39c9918 commit 4647684
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class SessionTest extends \PHPUnit\Framework\TestCase
/**
* Session ID in query param
*/
const SESSION_ID_QUERY_PARAM = 'SID';
private const SESSION_ID_QUERY_PARAM = 'SID';

/**
* @var \Magento\Customer\Model\Session
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class AbstractBlockTest extends \PHPUnit\Framework\TestCase
/**
* Session ID in query param
*/
const SESSION_ID_QUERY_PARAM = 'SID';
private const SESSION_ID_QUERY_PARAM = 'SID';

/**
* @var AbstractBlock
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class RedirectTest extends AbstractController
/**
* Session ID in query param
*/
const SESSION_ID_QUERY_PARAM = 'SID';
private const SESSION_ID_QUERY_PARAM = 'SID';

/**
* @var RedirectDataPreprocessorInterface
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
class StoreTest extends \PHPUnit\Framework\TestCase
{
/**
* Session ID in query param
* Test ID in query param
*/
const SESSION_ID_QUERY_PARAM = 'SID';
private const TEST_ID_QUERY_PARAM = 'TID';

/**
* @var array
Expand Down Expand Up @@ -308,11 +308,11 @@ public function testGetCurrentUrl()

$this->model
->expects($this->any())->method('getUrl')
->willReturn('http://localhost/index.php?' . self::SESSION_ID_QUERY_PARAM . '=12345');
$this->request->setParams([self::SESSION_ID_QUERY_PARAM, '12345']);
$this->request->setQueryValue(self::SESSION_ID_QUERY_PARAM, '12345');
->willReturn('http://localhost/index.php?' . self::TEST_ID_QUERY_PARAM . '=12345');
$this->request->setParams([self::TEST_ID_QUERY_PARAM, '12345']);
$this->request->setQueryValue(self::TEST_ID_QUERY_PARAM, '12345');
$this->assertStringContainsString(
self::SESSION_ID_QUERY_PARAM . '=12345',
self::TEST_ID_QUERY_PARAM . '=12345',
$this->model->getCurrentUrl()
);

Expand All @@ -330,11 +330,11 @@ public function testGetCurrentUrl()
$url
);
$this->assertEquals(
$secondStore->getBaseUrl() . '?SID=12345&___from_store=default',
$secondStore->getBaseUrl() . '?' . self::TEST_ID_QUERY_PARAM . '=12345&___from_store=default',
$secondStore->getCurrentUrl()
);
$this->assertEquals(
$secondStore->getBaseUrl() . '?SID=12345',
$secondStore->getBaseUrl() . '?' . self::TEST_ID_QUERY_PARAM . '=12345',
$secondStore->getCurrentUrl(false)
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ class UiComponentFactory extends DataObject
/**
* The key arguments in the data component
*/
const COMPONENT_ARGUMENTS_KEY = 'arguments';
private const COMPONENT_ARGUMENTS_KEY = 'arguments';

/**
* The key attributes in the data component
*/
const COMPONENT_ATTRIBUTES_KEY = 'attributes';
private const COMPONENT_ATTRIBUTES_KEY = 'attributes';

/**
* Object manager
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,17 @@
use Magento\Framework\View\Element\AbstractBlock;
use Magento\Framework\View\Element\UiComponent\ContextInterface;
use Magento\Framework\View\Element\UiComponent\Factory\HtmlContentFactory;
use Magento\Framework\View\Element\UiComponentFactory;
use Magento\Framework\View\Layout;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;

class HtmlContentFactoryTest extends TestCase
{
/**
* The key arguments in the data component
*/
private const COMPONENT_ARGUMENTS_KEY = 'arguments';

/**
* @var Layout|MockObject
*/
Expand Down Expand Up @@ -55,7 +59,7 @@ protected function setUp(): void
public function testCreate()
{
$blockName = 'blockName';
$bundleComponents[UiComponentFactory::COMPONENT_ARGUMENTS_KEY]['block']['name'] = $blockName;
$bundleComponents[self::COMPONENT_ARGUMENTS_KEY]['block']['name'] = $blockName;
$this->layout->expects($this->once())
->method('getBlock')
->with($blockName)
Expand All @@ -71,6 +75,6 @@ public function testCreate()
]
)
);
$this->assertEquals($this->block, $bundleComponents[UiComponentFactory::COMPONENT_ARGUMENTS_KEY]['block']);
$this->assertEquals($this->block, $bundleComponents[self::COMPONENT_ARGUMENTS_KEY]['block']);
}
}

0 comments on commit 4647684

Please sign in to comment.