Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AttributeSelectorTest.php
Go to the documentation of this file.
1 <?php
7 
8 class AttributeSelectorTest extends \PHPUnit\Framework\TestCase
9 {
13  protected $attributeSelector;
14 
18  protected $urlBuilder;
19 
20  protected function setUp()
21  {
22  $helper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
23  $this->urlBuilder = $this->createMock(\Magento\Framework\UrlInterface::class);
24  $this->attributeSelector = $helper->getObject(
25  \Magento\ConfigurableProduct\Block\Product\Configurable\AttributeSelector::class,
26  ['urlBuilder' => $this->urlBuilder]
27  );
28  }
29 
31  {
32  $this->urlBuilder->expects(
33  $this->once()
34  )->method(
35  'getUrl'
36  )->with(
37  '*/product_set/save'
38  )->will(
39  $this->returnValue('some_url')
40  );
41  $this->assertEquals('some_url', $this->attributeSelector->getAttributeSetCreationUrl());
42  }
43 
44  public function testGetSuggestWidgetOptions()
45  {
46  $source = 'source_url';
47  $this->urlBuilder->expects(
48  $this->once()
49  )->method(
50  'getUrl'
51  )->with(
52  '*/product_attribute/suggestConfigurableAttributes'
53  )->will(
54  $this->returnValue($source)
55  );
56  $expected = ['source' => $source, 'minLength' => 0, 'className' => 'category-select', 'showAll' => true];
57  $this->assertEquals($expected, $this->attributeSelector->getSuggestWidgetOptions());
58  }
59 }
$helper
Definition: iframe.phtml:13
$source
Definition: source.php:23