diff --git a/includes/MslsMetaBox.php b/includes/MslsMetaBox.php
index bb0396b8..73124c1e 100644
--- a/includes/MslsMetaBox.php
+++ b/includes/MslsMetaBox.php
@@ -273,7 +273,7 @@ public function render_option( int $post_id, ?int $msls_id ): string {
return wp_kses(
sprintf(
'',
- esc_attr( $post_id ),
+ esc_attr( strval( $post_id ) ),
selected( $post_id, $msls_id, false ),
get_the_title( $post_id )
),
diff --git a/phpunit.xml b/phpunit.xml
index 4882878a..c10c51d2 100644
--- a/phpunit.xml
+++ b/phpunit.xml
@@ -4,8 +4,16 @@
bootstrap="tests/phpunit/bootstrap.php"
backupGlobals="true"
colors="true"
+ testdox="false"
+ displayDetailsOnIncompleteTests="true"
+ displayDetailsOnSkippedTests="true"
+ displayDetailsOnTestsThatTriggerDeprecations="true"
+ displayDetailsOnTestsThatTriggerErrors="true"
+ displayDetailsOnTestsThatTriggerNotices="true"
displayDetailsOnTestsThatTriggerWarnings="true"
- cacheDirectory=".phpunit.cache">
+ displayDetailsOnPhpunitDeprecations="true"
+ cacheDirectory=".phpunit.cache"
+>
diff --git a/tests/phpunit/ContentImport/TestAttachmentPathFinder.php b/tests/phpunit/ContentImport/TestAttachmentPathFinder.php
index b7824b62..5c5daa25 100644
--- a/tests/phpunit/ContentImport/TestAttachmentPathFinder.php
+++ b/tests/phpunit/ContentImport/TestAttachmentPathFinder.php
@@ -44,4 +44,33 @@ public function test_filter_srcset( $source, $imageSrc, $attachmentId, $expected
$this->assertEquals( $expected, $this->test->filter_srcset( $source, null, $imageSrc, null, $attachmentId ) );
}
+
+ public static function dataprovider_filter_attachement_url(): array {
+ $generic_obj = (object) array( 'guid' => 'http://example.com/image.jpg' );
+
+ $post_mock = \Mockery::mock( '\WP_Post' );
+ $post_mock->guid = 'http://example.com/image.jpg';
+
+ return array(
+ array( 'http://example.com/image.jpg', $generic_obj, 42 ),
+ array( 'http://example.com/image.jpg', $generic_obj, 0 ),
+ array( 'http://example.com/image.jpg', $post_mock, 42 ),
+ );
+ }
+
+ /**
+ * @dataProvider dataprovider_filter_attachement_url
+ */
+ public function test_filter_attachment_url( string $image_src, $source_post, int $attachment_id ): void {
+ $msls_imported = array(
+ 'blog' => 1,
+ 'post' => 1,
+ );
+
+ Functions\expect( 'get_post_meta' )->zeroOrMoreTimes()->andReturn( $msls_imported );
+ Functions\expect( 'delete_post_meta' )->zeroOrMoreTimes();
+ Functions\expect( 'get_blog_post' )->zeroOrMoreTimes()->andReturn( $source_post );
+
+ $this->assertEquals( $source_post->guid, $this->test->filter_attachment_url( $image_src, $attachment_id ) );
+ }
}