コード例 #1
0
 public function setUp()
 {
     $this->option = $this->getMock('Magento\\Eav\\Model\\Resource\\Entity\\Attribute\\Option', [], [], '', false);
     $this->optionFactory = $this->getMock('Magento\\Eav\\Model\\Resource\\Entity\\Attribute\\OptionFactory', ['create']);
     $this->optionFactory->expects($this->any())->method('create')->will($this->returnValue($this->option));
     $this->attribute = $this->getMock('Magento\\Eav\\Model\\Entity\\Attribute\\AbstractAttribute', [], [], '', false);
     $this->model = (new ObjectManager($this))->getObject('Magento\\Bundle\\Model\\Product\\Attribute\\Source\\Price\\View', ['optionFactory' => $this->optionFactory]);
     $this->model->setAttribute($this->attribute);
 }
コード例 #2
0
ファイル: ViewTest.php プロジェクト: Atlis/docker-magento2
 public function testGetFlatColums()
 {
     $abstractAttributeMock = $this->getMock('\\Magento\\Eav\\Model\\Entity\\Attribute\\AbstractAttribute', array('getAttributeCode', '__wakeup'), array(), '', false);
     $abstractAttributeMock->expects($this->any())->method('getAttributeCode')->will($this->returnValue('code'));
     $this->_model->setAttribute($abstractAttributeMock);
     $flatColums = $this->_model->getFlatColums();
     $this->assertTrue(is_array($flatColums), 'FlatColums must be an array value');
     $this->assertTrue(!empty($flatColums), 'FlatColums must be not empty');
     foreach ($flatColums as $result) {
         $this->assertArrayHasKey('unsigned', $result, 'FlatColums must have "unsigned" column');
         $this->assertArrayHasKey('default', $result, 'FlatColums must have "default" column');
         $this->assertArrayHasKey('extra', $result, 'FlatColums must have "extra" column');
         $this->assertArrayHasKey('type', $result, 'FlatColums must have "type" column');
         $this->assertArrayHasKey('nullable', $result, 'FlatColums must have "nullable" column');
         $this->assertArrayHasKey('comment', $result, 'FlatColums must have "comment" column');
     }
 }