Completed
Push — try/xmlrpc-server-package-clas... ( 6199c0...8e0ceb )
by
unknown
07:26
created

Test_Logo   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 79
Duplicated Lines 32.91 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
dl 26
loc 79
rs 10
c 0
b 0
f 0
wmc 8
lcom 1
cbo 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A test_constructor_default_logo() 0 9 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
use Automattic\Jetpack\Assets\Logo;
4
5
use PHPUnit\Framework\TestCase;
6
7
class Test_Logo extends TestCase {
8
9
	/**
10
	 * Ensure the rendered logo has all the CSS classes needed for styling.
11
	 */
12
	function test_constructor_default_logo() {
13
		$logo = new Logo();
14
		$logo_render = $logo->render();
15
		$this->assertContains( '<svg xmlns="http://www.w3.org/2000/svg"', $logo_render );
16
		$this->assertContains( 'class="jetpack-logo"', $logo_render );
17
		$this->assertContains( 'class="jetpack-logo__icon-circle"', $logo_render );
18
		$this->assertEquals( 2, preg_match_all( '/class="jetpack-logo__icon-triangle"/', $logo_render ) );
19
		$this->assertContains( 'class="jetpack-logo__text"', $logo_render );
20
	}
21
22
}
23