@@ -55,10 +55,21 @@ public function get_schema_script_data() {
5555 * @param int $expected Expected count of valid JSON+LD schema.
5656 */
5757 public function test_transform ( $ json , $ expected ) {
58- $ html = '<html><head><script type="application/ld+json">%s</script></head><body>Test</body></html> ' ;
59- $ dom = Document::fromHtml ( sprintf ( $ html , $ json ), Options::DEFAULTS );
60- $ transformer = new AmpSchemaOrgMetadata ( new AmpSchemaOrgMetadataConfiguration () );
61- $ errors = new ErrorCollection ();
58+ $ html = '<html><head><script type="application/ld+json">%s</script></head><body>Test</body></html> ' ;
59+ $ dom = Document::fromHtml ( sprintf ( $ html , $ json ), Options::DEFAULTS );
60+ $ configuration = new AmpSchemaOrgMetadataConfiguration (
61+ [
62+ AmpSchemaOrgMetadataConfiguration::METADATA => [
63+ '@context ' => 'http://schema.org ' ,
64+ 'publisher ' => [
65+ '@type ' => 'Organization ' ,
66+ 'name ' => 'Acme ' ,
67+ ],
68+ ],
69+ ]
70+ );
71+ $ transformer = new AmpSchemaOrgMetadata ( $ configuration );
72+ $ errors = new ErrorCollection ();
6273 $ transformer ->transform ( $ dom , $ errors );
6374 $ this ->assertEquals ( $ expected , substr_count ( $ dom ->saveHTML (), 'schema.org ' ) );
6475 }
@@ -69,8 +80,6 @@ public function test_transform( $json, $expected ) {
6980 * @covers ::transform
7081 */
7182 public function test_empty_metadata_configuration () {
72- add_filter ( 'amp_schemaorg_metadata ' , '__return_empty_array ' );
73-
7483 $ dom = new Document ();
7584 $ transformer = new AmpSchemaOrgMetadata ( new AmpSchemaOrgMetadataConfiguration () );
7685 $ transformer ->transform ( $ dom , new ErrorCollection () );
0 commit comments