diff --git a/tests/test-class-wp-web-app-manifest.php b/tests/test-class-wp-web-app-manifest.php index c031a9d42..cdfadcc1a 100644 --- a/tests/test-class-wp-web-app-manifest.php +++ b/tests/test-class-wp-web-app-manifest.php @@ -97,10 +97,44 @@ public function test_init() { * @covers WP_Web_App_Manifest::manifest_link_and_meta() */ public function test_manifest_link_and_meta() { + $this->mock_site_icon(); + + $added_images = array( + array( + 'href' => home_url( '/340.png' ), + 'media' => '(device-width: 340px)', + ), + array( + 'href' => home_url( '/480.png' ), + ), + ); + + add_filter( + 'apple_touch_startup_images', + function ( $images ) use ( $added_images ) { + $this->assertInternalType( 'array', $images ); + $this->assertCount( 1, $images ); + $images = array_merge( $images, $added_images ); + $images[] = array( 'bad' => 'yes' ); + return $images; + } + ); + ob_start(); $this->instance->manifest_link_and_meta(); $output = ob_get_clean(); + $this->assertSame( 3, substr_count( $output, 'assertContains( sprintf( '', esc_url( get_site_icon_url() ) ), $output ); + foreach ( $added_images as $added_image ) { + $tag = sprintf( 'assertContains( $tag, $output ); + } + $this->assertContains( 'assertContains( rest_url( WP_Web_App_Manifest::REST_NAMESPACE . WP_Web_App_Manifest::REST_ROUTE ), $output ); $this->assertContains( '