LinkingTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
dl 0
loc 24
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A should_not_create_an_attachment_in_the_destination_site() 0 17 1
1
<?php
2
3
namespace lloc\Msls\ContentImport\Importers\Attachments;
4
5
6
use lloc\Msls\ContentImport\TestCase;
7
8
class LinkingTest extends TestCase {
9
	/**
10
	 * It should not create an attachment in the destination site
11
	 *
12
	 * @test
13
	 */
14
	public function should_not_create_an_attachment_in_the_destination_site() {
15
		list( $import_coordinates, $logger, $relations, $dest_post_data ) = $this->setup_source_and_dest();
16
		$dest_post_id = $import_coordinates->dest_post_id;
17
18
		switch_to_blog( $import_coordinates->source_blog_id );
19
		$this->factory()->attachment->create_upload_object( msls_test_data( 'images/image-one.jpg' ) );
20
21
		// the import functionality should work starting fron any blog context
22
		restore_current_blog();
23
24
		$obj = new Linking( $import_coordinates, $logger->reveal(), $relations->reveal() );
25
26
		$mutated = $obj->import( $dest_post_data );
27
28
		$this->assertEmpty( get_attached_media( 'image', $dest_post_id ) );
29
		$this->assertEquals( $mutated, $dest_post_data );
30
	}
31
}
32