@@ -7,48 +7,48 @@ |
||
7 | 7 | class RoboFile extends \Robo\Tasks |
8 | 8 | { |
9 | 9 | // define public methods as commands |
10 | - function tests() |
|
11 | - { |
|
12 | - |
|
13 | - $this->taskExec('mysql -e "CREATE DATABASE IF NOT EXISTS test_db"')->run(); |
|
14 | - $this->taskExec('mysql -e "GRANT ALL ON test_db.* to \'root\'@\'%\'"')->run(); |
|
15 | - $this->taskSvnStack() |
|
16 | - ->checkout('https://develop.svn.wordpress.org/tags/4.8.3 wp-tests') |
|
17 | - ->run(); |
|
18 | - |
|
19 | - $this->setTestConfig(); |
|
20 | - $this->phpunit(); |
|
21 | - |
|
22 | - } |
|
23 | - |
|
24 | - function phpunit() |
|
25 | - { |
|
26 | - $this->taskPhpUnit('vendor/bin/phpunit') |
|
27 | - ->configFile('tests/phpunit.xml.dist') |
|
28 | - ->run(); |
|
29 | - } |
|
30 | - |
|
31 | - private function setTestConfig() |
|
32 | - { |
|
33 | - |
|
34 | - if (file_exists('wp-tests/wp-tests-config-sample.php')) { |
|
35 | - copy('wp-tests/wp-tests-config-sample.php', 'wp-tests/wp-tests-config.php'); |
|
36 | - } |
|
37 | - |
|
38 | - $this->taskReplaceInFile( 'wp-tests/wp-tests-config.php') |
|
39 | - ->from('youremptytestdbnamehere') |
|
40 | - ->to('test_db') |
|
41 | - ->run(); |
|
42 | - |
|
43 | - $this->taskReplaceInFile( 'wp-tests/wp-tests-config.php') |
|
44 | - ->from('yourusernamehere') |
|
45 | - ->to('root') |
|
46 | - ->run(); |
|
47 | - |
|
48 | - $this->taskReplaceInFile( 'wp-tests/wp-tests-config.php') |
|
49 | - ->from('yourpasswordhere') |
|
50 | - ->to('') |
|
51 | - ->run(); |
|
52 | - } |
|
10 | + function tests() |
|
11 | + { |
|
12 | + |
|
13 | + $this->taskExec('mysql -e "CREATE DATABASE IF NOT EXISTS test_db"')->run(); |
|
14 | + $this->taskExec('mysql -e "GRANT ALL ON test_db.* to \'root\'@\'%\'"')->run(); |
|
15 | + $this->taskSvnStack() |
|
16 | + ->checkout('https://develop.svn.wordpress.org/tags/4.8.3 wp-tests') |
|
17 | + ->run(); |
|
18 | + |
|
19 | + $this->setTestConfig(); |
|
20 | + $this->phpunit(); |
|
21 | + |
|
22 | + } |
|
23 | + |
|
24 | + function phpunit() |
|
25 | + { |
|
26 | + $this->taskPhpUnit('vendor/bin/phpunit') |
|
27 | + ->configFile('tests/phpunit.xml.dist') |
|
28 | + ->run(); |
|
29 | + } |
|
30 | + |
|
31 | + private function setTestConfig() |
|
32 | + { |
|
33 | + |
|
34 | + if (file_exists('wp-tests/wp-tests-config-sample.php')) { |
|
35 | + copy('wp-tests/wp-tests-config-sample.php', 'wp-tests/wp-tests-config.php'); |
|
36 | + } |
|
37 | + |
|
38 | + $this->taskReplaceInFile( 'wp-tests/wp-tests-config.php') |
|
39 | + ->from('youremptytestdbnamehere') |
|
40 | + ->to('test_db') |
|
41 | + ->run(); |
|
42 | + |
|
43 | + $this->taskReplaceInFile( 'wp-tests/wp-tests-config.php') |
|
44 | + ->from('yourusernamehere') |
|
45 | + ->to('root') |
|
46 | + ->run(); |
|
47 | + |
|
48 | + $this->taskReplaceInFile( 'wp-tests/wp-tests-config.php') |
|
49 | + ->from('yourpasswordhere') |
|
50 | + ->to('') |
|
51 | + ->run(); |
|
52 | + } |
|
53 | 53 | |
54 | 54 | } |
55 | 55 | \ No newline at end of file |
@@ -118,16 +118,16 @@ |
||
118 | 118 | |
119 | 119 | } |
120 | 120 | |
121 | - /** |
|
122 | - * @return array |
|
123 | - */ |
|
124 | - function make_args() { |
|
121 | + /** |
|
122 | + * @return array |
|
123 | + */ |
|
124 | + function make_args() { |
|
125 | 125 | |
126 | - return array( |
|
127 | - 'center' => $this->center(), |
|
128 | - 'zoom' => (int)$this->zoom() |
|
129 | - ); |
|
126 | + return array( |
|
127 | + 'center' => $this->center(), |
|
128 | + 'zoom' => (int)$this->zoom() |
|
129 | + ); |
|
130 | 130 | |
131 | - } |
|
131 | + } |
|
132 | 132 | |
133 | 133 | } |
@@ -81,22 +81,22 @@ |
||
81 | 81 | $this->assertEquals(12, $this->_model->zoom()); |
82 | 82 | } |
83 | 83 | |
84 | - /** |
|
85 | - * @covers ::make_args |
|
86 | - */ |
|
84 | + /** |
|
85 | + * @covers ::make_args |
|
86 | + */ |
|
87 | 87 | public function testMakeArgs() { |
88 | 88 | |
89 | - $args = $this->_model->make_args(); |
|
90 | - |
|
91 | - $this->assertInternalType('array', $args); |
|
92 | - $this->assertArrayHasKey('center', $args); |
|
93 | - $this->assertArrayHasKey('zoom', $args); |
|
94 | - $this->assertInternalType('array', $args['center']); |
|
95 | - $this->assertInternalType('integer', $args['zoom']); |
|
96 | - $this->assertArrayHasKey('lat', $args['center']); |
|
97 | - $this->assertArrayHasKey('lat', $args['center']); |
|
98 | - $this->assertInternalType('float', $args['center']['lat']); |
|
99 | - $this->assertInternalType('float', $args['center']['lng']); |
|
89 | + $args = $this->_model->make_args(); |
|
90 | + |
|
91 | + $this->assertInternalType('array', $args); |
|
92 | + $this->assertArrayHasKey('center', $args); |
|
93 | + $this->assertArrayHasKey('zoom', $args); |
|
94 | + $this->assertInternalType('array', $args['center']); |
|
95 | + $this->assertInternalType('integer', $args['zoom']); |
|
96 | + $this->assertArrayHasKey('lat', $args['center']); |
|
97 | + $this->assertArrayHasKey('lat', $args['center']); |
|
98 | + $this->assertInternalType('float', $args['center']['lat']); |
|
99 | + $this->assertInternalType('float', $args['center']['lng']); |
|
100 | 100 | |
101 | 101 | } |
102 | 102 | } |
@@ -63,12 +63,12 @@ |
||
63 | 63 | return $reflection->invoke( $class, $args ); |
64 | 64 | } |
65 | 65 | |
66 | - /** |
|
67 | - * @return string |
|
68 | - */ |
|
66 | + /** |
|
67 | + * @return string |
|
68 | + */ |
|
69 | 69 | public function get_sample_response() { |
70 | 70 | |
71 | - return file_get_contents( __DIR__ . '/geocoder-response.json' ); |
|
71 | + return file_get_contents( __DIR__ . '/geocoder-response.json' ); |
|
72 | 72 | |
73 | 73 | } |
74 | 74 | } |
75 | 75 | \ No newline at end of file |
@@ -14,24 +14,24 @@ |
||
14 | 14 | */ |
15 | 15 | class TestGoogleMaps extends TestCase { |
16 | 16 | |
17 | - /** |
|
18 | - * @covers ::_wp_enqueue_scripts_9 |
|
19 | - */ |
|
20 | - function testScriptRegistered() { |
|
21 | - $this->assertTrue(wp_script_is('google-maps', 'registered')); |
|
22 | - $this->assertTrue(wp_script_is('map-control', 'registered')); |
|
23 | - } |
|
24 | - |
|
25 | - /** |
|
26 | - * @covers ::_wp_enqueue_scripts_9 |
|
27 | - * @depends testScriptRegistered |
|
28 | - */ |
|
29 | - function testScriptEnqueued() { |
|
30 | - |
|
31 | - Google_Maps::register_script_condition(function(){return true;}); |
|
32 | - |
|
33 | - $this->assertTrue(wp_script_is('google-maps', 'enqueued')); |
|
34 | - $this->assertTrue(wp_script_is('map-control', 'enqueued')); |
|
35 | - |
|
36 | - } |
|
17 | + /** |
|
18 | + * @covers ::_wp_enqueue_scripts_9 |
|
19 | + */ |
|
20 | + function testScriptRegistered() { |
|
21 | + $this->assertTrue(wp_script_is('google-maps', 'registered')); |
|
22 | + $this->assertTrue(wp_script_is('map-control', 'registered')); |
|
23 | + } |
|
24 | + |
|
25 | + /** |
|
26 | + * @covers ::_wp_enqueue_scripts_9 |
|
27 | + * @depends testScriptRegistered |
|
28 | + */ |
|
29 | + function testScriptEnqueued() { |
|
30 | + |
|
31 | + Google_Maps::register_script_condition(function(){return true;}); |
|
32 | + |
|
33 | + $this->assertTrue(wp_script_is('google-maps', 'enqueued')); |
|
34 | + $this->assertTrue(wp_script_is('map-control', 'enqueued')); |
|
35 | + |
|
36 | + } |
|
37 | 37 | } |
38 | 38 | \ No newline at end of file |