11 require_once(
'./libs/composer/vendor/autoload.php');
23 protected function setUp(): void
26 $this->version =
'1.2.3.4.5.6.7.8.9';
27 $this->meta_content =
new MetaContent($this->version);
32 $path =
'/path/to/file.css';
33 $this->meta_content->addCss(
$path);
34 $collection = $this->meta_content->getCss();
36 $first_item = iterator_to_array($collection->getItems())[0];
37 $this->assertInstanceOf(Css::class, $first_item);
38 $this->assertEquals(
$path .
'?version=' . $this->version, $first_item->getContent());
44 $path =
'/path/to/file.css?my=query';
45 $this->meta_content->addCss(
$path);
46 $collection = $this->meta_content->getCss();
48 $first_item = iterator_to_array($collection->getItems())[0];
49 $this->assertInstanceOf(Css::class, $first_item);
50 $this->assertEquals(
$path .
'&version=' . $this->version, $first_item->getContent());
56 $css =
'body {background-color:red;}';
57 $this->meta_content->addInlineCss($css);
58 $collection = $this->meta_content->getInlineCss();
60 $first_item = iterator_to_array($collection->getItems())[0];
61 $this->assertInstanceOf(InlineCss::class, $first_item);
62 $this->assertEquals($css, $first_item->getContent());
68 $path =
'/path/to/file.js';
69 $this->meta_content->addJs(
$path);
70 $collection = $this->meta_content->getJs();
72 $first_item = iterator_to_array($collection->getItems())[
$path];
73 $this->assertInstanceOf(Js::class, $first_item);
74 $this->assertEquals(
$path .
'?version=' . $this->version, $first_item->getContent());
75 $this->assertEquals(2, $first_item->getBatch());
80 $path =
'/path/to/file.js';
81 $path_with_query =
$path .
'?my=query';
82 $this->meta_content->addJs($path_with_query);
83 $collection = $this->meta_content->getJs();
85 $first_item = iterator_to_array($collection->getItems())[
$path];
86 $this->assertInstanceOf(Js::class, $first_item);
87 $this->assertEquals($path_with_query .
'&version=' . $this->version, $first_item->getContent());
88 $this->assertEquals(2, $first_item->getBatch());
PhpIncompatibleReturnTypeInspection