Completed
Push — master ( 6c0735...dd8543 )
by Dennis
06:47
created

ServiceTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
dl 0
loc 34
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A test_register_when_content_import_deactivated() 0 11 1
A test_register_when_content_import_activated() 0 13 1
1
<?php
2
3
namespace lloc\Msls\ContentImport;
4
5
use lloc\Msls\MslsOptions;
6
use lloc\Msls\MslsRegistry;
7
8
class ServiceTest extends \Msls_UnitTestCase {
9
10
	/**
11
	 * Test register when content import deactivated
12
	 */
13
	public function test_register_when_content_import_deactivated() {
14
		$blog_id = $this->factory->blog->create();
15
		update_blog_option( $blog_id, 'msls', [] );
16
		MslsRegistry::set_object( MslsOptions::class, null );
17
18
		switch_to_blog( $blog_id );
0 ignored issues
show
introduced by
switch_to_blog is not something you should ever need to do in a VIP theme context. Instead use an API (XML-RPC, REST) to interact with other sites if needed.
Loading history...
19
20
		$obj = Service::instance();
21
22
		$this->assertFalse( $obj->register() );
23
	}
24
25
	/**
26
	 * Test register when content import activated
27
	 */
28
	public function test_register_when_content_import_activated() {
29
		$blog_id = $this->factory->blog->create();
30
		update_blog_option( $blog_id, 'msls', [
31
			'activate_content_import' => '1',
32
		] );
33
		MslsRegistry::set_object( MslsOptions::class, null );
34
35
		switch_to_blog( $blog_id );
0 ignored issues
show
introduced by
switch_to_blog is not something you should ever need to do in a VIP theme context. Instead use an API (XML-RPC, REST) to interact with other sites if needed.
Loading history...
36
37
		$obj = Service::instance();
38
39
		$this->assertTrue( $obj->register() );
40
	}
41
}
42