◆ getMockedImage()
OpenGraphMetadataTest::getMockedImage |
( |
string |
$html | ) |
|
|
protected |
Definition at line 186 of file OpenGraphMetadataTest.php.
Referenced by testWebsiteTag().
188 $mock_image = $this->createMock(Image::class);
189 $mock_image->method(
'toHtml')->willReturn($html);
190 $mock_image->method(
'getTags')->willReturnCallback(
191 static function () use ($mock_image):
Generator {
◆ getMockedResource()
OpenGraphMetadataTest::getMockedResource |
( |
string |
$html | ) |
|
|
protected |
Definition at line 173 of file OpenGraphMetadataTest.php.
Referenced by testWebsiteTag().
175 $mock_resource = $this->createMock(Resource::class);
176 $mock_resource->method(
'toHtml')->willReturn($html);
177 $mock_resource->method(
'getTags')->willReturnCallback(
178 static function () use ($mock_resource):
Generator {
179 yield $mock_resource;
183 return $mock_resource;
◆ getMockedUrl()
OpenGraphMetadataTest::getMockedUrl |
( |
string |
$url | ) |
|
|
protected |
◆ setUp()
OpenGraphMetadataTest::setUp |
( |
| ) |
|
|
protected |
◆ testAudioTag()
OpenGraphMetadataTest::testAudioTag |
( |
| ) |
|
Definition at line 67 of file OpenGraphMetadataTest.php.
References factory(), and getMockedUrl().
69 $expected_url =
'test_url';
70 $expected_mime =
'test_mime_type';
72 "<meta property=\"og:audio\" content=\"$expected_url\" />" . PHP_EOL .
73 "<meta property=\"og:audio:type\" content=\"$expected_mime\" />" . PHP_EOL;
77 $this->assertEquals($expected_html, $audio_tag->toHtml());
◆ testImageTag()
OpenGraphMetadataTest::testImageTag |
( |
| ) |
|
Definition at line 80 of file OpenGraphMetadataTest.php.
References factory(), and getMockedUrl().
82 $expected_url =
'test_url';
83 $expected_mime =
'test_mime_type';
84 $expected_alt =
'test_aria_label';
85 $expected_width = 200;
86 $expected_height = 100;
88 "<meta property=\"og:image\" content=\"$expected_url\" />" . PHP_EOL .
89 "<meta property=\"og:image:type\" content=\"$expected_mime\" />" . PHP_EOL .
90 "<meta property=\"og:image:alt\" content=\"$expected_alt\" />" . PHP_EOL .
91 "<meta property=\"og:image:width\" content=\"$expected_width\" />" . PHP_EOL .
92 "<meta property=\"og:image:height\" content=\"$expected_height\" />" . PHP_EOL;
94 $image_tag = $this->
factory->image(
102 $this->assertEquals($expected_html, $image_tag->toHtml());
◆ testLinkTag()
OpenGraphMetadataTest::testLinkTag |
( |
| ) |
|
◆ testTextTag()
OpenGraphMetadataTest::testTextTag |
( |
| ) |
|
Definition at line 41 of file OpenGraphMetadataTest.php.
43 $property =
'test_property';
44 $value =
'test_value';
46 $link_tag =
new Text($property, $value);
49 "<meta property=\"$property\" content=\"$value\" />",
◆ testVideoTag()
OpenGraphMetadataTest::testVideoTag |
( |
| ) |
|
Definition at line 105 of file OpenGraphMetadataTest.php.
References factory(), and getMockedUrl().
107 $expected_url =
'test_url';
108 $expected_mime =
'test_mime_type';
109 $expected_width = 200;
110 $expected_height = 100;
112 "<meta property=\"og:video\" content=\"$expected_url\" />" . PHP_EOL .
113 "<meta property=\"og:video:type\" content=\"$expected_mime\" />" . PHP_EOL .
114 "<meta property=\"og:video:width\" content=\"$expected_width\" />" . PHP_EOL .
115 "<meta property=\"og:video:height\" content=\"$expected_height\" />" . PHP_EOL;
117 $video_tag = $this->
factory->video(
124 $this->assertEquals($expected_html, $video_tag->toHtml());
◆ testWebsiteTag()
OpenGraphMetadataTest::testWebsiteTag |
( |
| ) |
|
Definition at line 127 of file OpenGraphMetadataTest.php.
References factory(), getMockedImage(), getMockedResource(), and getMockedUrl().
129 $expected_canonical_url =
'test_canonical_url';
130 $expected_image_html =
'test_image_html';
131 $expected_object_title =
'test_object_title';
132 $expected_website_name =
'test_website_name';
133 $expected_description =
'test_description';
134 $expected_locale =
'test_locale';
135 $expected_locale_alt_1 =
'test_locale_alt_1';
136 $expected_locale_alt_2 =
'test_locale_alt_2';
137 $expected_additional_resource_html_1 =
'test_additional_resource_html_1';
138 $expected_additional_resource_html_2 =
'test_additional_resource_html_2';
141 "<meta property=\"og:type\" content=\"website\" />" . PHP_EOL .
142 "<meta property=\"og:title\" content=\"test_object_title\" />" . PHP_EOL .
143 "<meta property=\"og:url\" content=\"test_canonical_url\" />" . PHP_EOL .
144 $expected_image_html . PHP_EOL .
145 "<meta property=\"og:site_title\" content=\"test_website_name\" />" . PHP_EOL .
146 "<meta property=\"og:description\" content=\"test_description\" />" . PHP_EOL .
147 "<meta property=\"og:locale\" content=\"test_locale\" />" . PHP_EOL .
148 "<meta property=\"og:locale:alternative\" content=\"test_locale_alt_1\" />" . PHP_EOL .
149 "<meta property=\"og:locale:alternative\" content=\"test_locale_alt_2\" />" . PHP_EOL .
150 $expected_additional_resource_html_1 . PHP_EOL .
151 $expected_additional_resource_html_2 . PHP_EOL;
153 $website_tag = $this->
factory->website(
156 $expected_object_title,
157 $expected_website_name,
158 $expected_description,
161 $expected_locale_alt_1,
162 $expected_locale_alt_2,
170 $this->assertEquals($expected_html, $website_tag->toHtml());
◆ $factory
Factory OpenGraphMetadataTest::$factory |
|
protected |
The documentation for this class was generated from the following file: