test_register_when_content_import_deactivated()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 11
rs 9.9
c 0
b 0
f 0
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 );
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 );
36
37
		$obj = Service::instance();
38
39
		$this->assertTrue( $obj->register() );
40
	}
41
}
42