Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
VideoEntryTest.php
Go to the documentation of this file.
1 <?php
7 
11 class VideoEntryTest extends \PHPUnit\Framework\TestCase
12 {
16  protected $modelObject;
17 
21  protected function setUp()
22  {
23  $this->modelObject =
24  $this->createPartialMock(
25  \Magento\ProductVideo\Model\Product\Attribute\Media\VideoEntry::class,
26  ['getData', 'setData']
27  );
28  }
29 
33  public function testGetMediaType()
34  {
35  $this->modelObject->expects($this->once())->method('getData')->willReturn('image');
36  $this->modelObject->getMediaType();
37  }
38 
42  public function testSetMediaType()
43  {
44  $this->modelObject->expects($this->once())->method('setData')->willReturn($this->modelObject);
45  $this->modelObject->setMediaType('image');
46  }
47 
51  public function testGetVideoProvider()
52  {
53  $this->modelObject->expects($this->once())->method('getData')->willReturn('provider');
54  $this->modelObject->getVideoProvider();
55  }
56 
60  public function testSetVideoProvider()
61  {
62  $this->modelObject->expects($this->once())->method('setData')->willReturn($this->modelObject);
63  $this->modelObject->setVideoProvider('provider');
64  }
65 
69  public function testGetVideoUrl()
70  {
71  $this->modelObject->expects($this->once())->method('getData')->willReturn(
72  'https://www.url.com/watch?v=aaaaaaaaa'
73  );
74  $this->modelObject->getVideoUrl();
75  }
76 
80  public function testSetVideoUrl()
81  {
82  $this->modelObject->expects($this->once())->method('setData')->willReturn($this->modelObject);
83  $this->modelObject->setVideoUrl('https://www.url.com/watch?v=aaaaaaaaa');
84  }
85 
89  public function testGetVideoTitle()
90  {
91  $this->modelObject->expects($this->once())->method('getData')->willReturn('Title');
92  $this->modelObject->getVideoTitle();
93  }
94 
98  public function testSetVideoTitle()
99  {
100  $this->modelObject->expects($this->once())->method('setData')->willReturn($this->modelObject);
101  $this->modelObject->setVideoTitle('Title');
102  }
103 
107  public function testGetVideoDescription()
108  {
109  $this->modelObject->expects($this->once())->method('getData')->willReturn('Description');
110  $this->modelObject->getVideoDescription();
111  }
112 
116  public function testSetVideoDescription()
117  {
118  $this->modelObject->expects($this->once())->method('setData')->willReturn($this->modelObject);
119  $this->modelObject->setVideoDescription('Description');
120  }
121 
125  public function testGetVideoMetadata()
126  {
127  $this->modelObject->expects($this->once())->method('getData')->willReturn('Meta data');
128  $this->modelObject->getVideoMetadata();
129  }
130 
134  public function testSetVideoMetadata()
135  {
136  $this->modelObject->expects($this->once())->method('setData')->willReturn($this->modelObject);
137  $this->modelObject->setVideoMetadata('Meta data');
138  }
139 }
testSetMediaType()
testGetMediaType()
testGetVideoMetadata()
setUp()
testGetVideoUrl()
$modelObject
testGetVideoTitle()
testGetVideoProvider()
testGetVideoDescription()
testSetVideoDescription()
testSetVideoMetadata()
testSetVideoProvider()
testSetVideoTitle()
testSetVideoUrl()