13 class HeadTest extends \PHPUnit\Framework\TestCase
22 $this->model =
new Head();
27 $readerContextMock = $this->getMockBuilder(\
Magento\Framework\
View\
Layout\Reader\Context::class)
28 ->disableOriginalConstructor()
30 $structureMock = $this->getMockBuilder(\
Magento\Framework\
View\Page\
Config\Structure::class)
31 ->disableOriginalConstructor()
33 $readerContextMock->expects($this->once())
34 ->method(
'getPageConfigStructure')
35 ->willReturn($structureMock);
40 $structureMock->expects($this->at(0))
45 $structureMock->expects($this->at(1))
46 ->method(
'setMetaData')
47 ->with(
'meta_name',
'meta_content')
50 $structureMock->expects($this->at(2))
51 ->method(
'setMetaData')
52 ->with(
'og:video:secure_url',
'https://secure.example.com/movie.swf')
55 $structureMock->expects($this->at(3))
56 ->method(
'setMetaData')
57 ->with(
'og:locale:alternate',
'uk_UA')
60 $structureMock->expects($this->at(4))
62 ->with(
'path/file-3.css', [
'src' =>
'path/file-3.css',
'media' =>
'all',
'content_type' =>
'css'])
65 $structureMock->expects($this->at(5))
67 ->with(
'path/file.js', [
'src' =>
'path/file.js',
'defer' =>
'defer',
'content_type' =>
'js'])
70 $structureMock->expects($this->at(6))
72 ->with(
'http://url.com', [
'src' =>
'http://url.com',
'src_type' =>
'url'])
75 $structureMock->expects($this->at(7))
76 ->method(
'removeAssets')
77 ->with(
'path/remove/file.css')
80 $structureMock->expects($this->at(8))
81 ->method(
'setElementAttribute')
85 $structureMock->expects($this->at(9))
89 [
'src' =>
'path/file-1.css',
'media' =>
'all',
'content_type' =>
'css',
'order' => 10]
93 $structureMock->expects($this->at(10))
97 [
'src' =>
'path/file-2.css',
'media' =>
'all',
'content_type' =>
'css',
'order' => 30]
101 $this->assertEquals($this->model, $this->model->interpret($readerContextMock,
$element->children()[0]));
defined('TESTS_BP')||define('TESTS_BP' __DIR__