Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AttributeFactoryTest.php
Go to the documentation of this file.
1 <?php
7 
8 class AttributeFactoryTest extends \PHPUnit\Framework\TestCase
9 {
13  protected $_factory;
14 
18  protected $_arguments = ['test1', 'test2'];
19 
23  protected $_className = 'Test_Class';
24 
25  protected function setUp()
26  {
28  $objectManagerMock = $this->createMock(\Magento\Framework\ObjectManagerInterface::class);
29  $objectManagerMock->expects(
30  $this->any()
31  )->method(
32  'create'
33  )->will(
34  $this->returnCallback([$this, 'getModelInstance'])
35  );
36 
37  $this->_factory = new \Magento\Eav\Model\AttributeFactory($objectManagerMock);
38  }
39 
40  protected function tearDown()
41  {
42  unset($this->_factory);
43  }
44 
48  public function testCreateAttribute()
49  {
50  $this->assertEquals($this->_className, $this->_factory->createAttribute($this->_className, $this->_arguments));
51  }
52 
59  {
60  $this->assertInternalType('array', $arguments);
61  $this->assertArrayHasKey('data', $arguments);
62  $this->assertEquals($this->_arguments, $arguments['data']);
63 
64  return $className;
65  }
66 }
$arguments
if($currentSelectedMethod==$_code) $className
Definition: form.phtml:31