Completed
Push — add/password-package ( 635be6...1b9366 )
by
unknown
230:46 queued 220:53
created

Password_Checker_Test::test_password()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 9
rs 9.9666
c 0
b 0
f 0
1
<?php
2
/**
3
 * Tests the Password_Checker package.
4
 *
5
 * @package automattic/jetpack-password-checker
6
 */
7
8
use Automattic\Jetpack\Password_Checker;
9
use Brain\Monkey;
10
use PHPUnit\Framework\TestCase;
11
12
/**
13
 * Test Password_Checker class
14
 */
15
class Password_Checker_Test extends TestCase {
16
17
	/**
18
	 * Sets up the test.
19
	 *
20
	 * @before
21
	 */
22
	public function set_up() {
23
		if ( ! defined( 'JETPACK__VERSION' ) ) {
24
			define( 'JETPACK__VERSION', '7.5' );
25
		}
26
		Monkey\setUp();
27
		Monkey\Functions\stubs( array( '__' => null ) );
28
	}
29
30
	/**
31
	 * Tears down the test.
32
	 *
33
	 * @after
34
	 */
35
	public function tear_down() {
36
		Monkey\tearDown();
37
	}
38
39
	/**
40
	 * Test the password checker.
41
	 */
42
	public function test_password() {
43
		$password_checker = new Password_Checker( null );
44
45
		$test_results = $password_checker->test( '123', true );
46
		$this->assertFalse( $test_results['passed'] );
47
48
		$test_results = $password_checker->test( 'password', true );
49
		$this->assertTrue( $test_results['passed'] );
50
	}
51
}
52