27 require_once(
'./libs/composer/vendor/autoload.php');
45 protected function setUp() : void
48 $this->version =
'1.2.3.4.5.6.7.8.9';
49 $this->meta_content =
new MetaContent($this->version);
54 $path =
'/path/to/file.css';
55 $this->meta_content->addCss($path);
56 $collection = $this->meta_content->getCss();
58 $first_item = iterator_to_array($collection->getItems())[0];
59 $this->assertInstanceOf(Css::class, $first_item);
60 $this->assertEquals($path .
'?version=' . $this->version, $first_item->getContent());
66 $path =
'/path/to/file.css?my=query';
67 $this->meta_content->addCss($path);
68 $collection = $this->meta_content->getCss();
70 $first_item = iterator_to_array($collection->getItems())[0];
71 $this->assertInstanceOf(Css::class, $first_item);
72 $this->assertEquals($path .
'&version=' . $this->version, $first_item->getContent());
78 $css =
'body {background-color:red;}';
79 $this->meta_content->addInlineCss($css);
80 $collection = $this->meta_content->getInlineCss();
82 $first_item = iterator_to_array($collection->getItems())[0];
83 $this->assertInstanceOf(InlineCss::class, $first_item);
84 $this->assertEquals($css, $first_item->getContent());
90 $path =
'/path/to/file.js';
91 $this->meta_content->addJs($path);
92 $collection = $this->meta_content->getJs();
94 $first_item = iterator_to_array($collection->getItems())[$path];
95 $this->assertInstanceOf(Js::class, $first_item);
96 $this->assertEquals($path .
'?version=' . $this->version, $first_item->getContent());
97 $this->assertEquals(2, $first_item->getBatch());
102 $path =
'/path/to/file.js';
103 $path_with_query = $path .
'?my=query';
104 $this->meta_content->addJs($path_with_query);
105 $collection = $this->meta_content->getJs();
107 $first_item = iterator_to_array($collection->getItems())[$path];
108 $this->assertInstanceOf(Js::class, $first_item);
109 $this->assertEquals($path_with_query .
'&version=' . $this->version, $first_item->getContent());
110 $this->assertEquals(2, $first_item->getBatch());
PhpIncompatibleReturnTypeInspection