@@ -14,9 +14,9 @@ discard block |
||
14 | 14 | 'posts_per_page' => 1, |
15 | 15 | ); |
16 | 16 | |
17 | - $all_posts = new WP_Query( $query_args ); |
|
17 | + $all_posts = new WP_Query($query_args); |
|
18 | 18 | $post_id = null; |
19 | - while ( $all_posts->have_posts() ) : $all_posts->the_post(); |
|
19 | + while ($all_posts->have_posts()) : $all_posts->the_post(); |
|
20 | 20 | $post_id = get_the_ID(); |
21 | 21 | endwhile; |
22 | 22 | |
@@ -45,9 +45,9 @@ discard block |
||
45 | 45 | 'posts_per_page' => 1, |
46 | 46 | ); |
47 | 47 | |
48 | - $all_posts = new WP_Query( $query_args ); |
|
48 | + $all_posts = new WP_Query($query_args); |
|
49 | 49 | $post_id = null; |
50 | - while ( $all_posts->have_posts() ) : $all_posts->the_post(); |
|
50 | + while ($all_posts->have_posts()) : $all_posts->the_post(); |
|
51 | 51 | $post_id = get_the_ID(); |
52 | 52 | endwhile; |
53 | 53 | |
@@ -78,9 +78,9 @@ discard block |
||
78 | 78 | 'posts_per_page' => 1, |
79 | 79 | ); |
80 | 80 | |
81 | - $all_posts = new WP_Query( $query_args ); |
|
81 | + $all_posts = new WP_Query($query_args); |
|
82 | 82 | $post_id = null; |
83 | - while ( $all_posts->have_posts() ) : $all_posts->the_post(); |
|
83 | + while ($all_posts->have_posts()) : $all_posts->the_post(); |
|
84 | 84 | $post_id = get_the_ID(); |
85 | 85 | endwhile; |
86 | 86 | |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | ob_start(); |
104 | 104 | geodir_send_friend($data); |
105 | 105 | $output = ob_get_clean(); |
106 | - $this->assertContains( 'Email from GeoDirectory failed to send', $output ); |
|
106 | + $this->assertContains('Email from GeoDirectory failed to send', $output); |
|
107 | 107 | remove_filter('wp_mail', 'print_mail'); |
108 | 108 | remove_filter('wp_redirect', '__return_false'); |
109 | 109 | } |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | // reset the wpdb queries log, storing it on the profile stack if necessary |
41 | 41 | global $wpdb; |
42 | 42 | if ($this->stack) { |
43 | - $this->stack[count($this->stack)-1]['queries'] = $wpdb->queries; |
|
43 | + $this->stack[count($this->stack) - 1]['queries'] = $wpdb->queries; |
|
44 | 44 | } |
45 | 45 | $wpdb->queries = array(); |
46 | 46 | |
@@ -74,14 +74,14 @@ discard block |
||
74 | 74 | |
75 | 75 | if (isset($this->profile[$name])) { |
76 | 76 | $this->profile[$name]['time'] += $time; |
77 | - $this->profile[$name]['calls'] ++; |
|
77 | + $this->profile[$name]['calls']++; |
|
78 | 78 | $this->profile[$name]['cache_cold_hits'] += ($wp_object_cache->cold_cache_hits - $item['cache_cold_hits']); |
79 | 79 | $this->profile[$name]['cache_warm_hits'] += ($wp_object_cache->warm_cache_hits - $item['cache_warm_hits']); |
80 | 80 | $this->profile[$name]['cache_misses'] += ($wp_object_cache->cache_misses - $item['cache_misses']); |
81 | - $this->profile[$name]['cache_dirty_objects'] = array_add( $this->profile[$name]['cache_dirty_objects'], $cache_dirty_delta) ; |
|
82 | - $this->profile[$name]['actions'] = array_add( $this->profile[$name]['actions'], $item['actions'] ); |
|
83 | - $this->profile[$name]['filters'] = array_add( $this->profile[$name]['filters'], $item['filters'] ); |
|
84 | - $this->profile[$name]['queries'] = array_add( $this->profile[$name]['queries'], $item['queries'] ); |
|
81 | + $this->profile[$name]['cache_dirty_objects'] = array_add($this->profile[$name]['cache_dirty_objects'], $cache_dirty_delta); |
|
82 | + $this->profile[$name]['actions'] = array_add($this->profile[$name]['actions'], $item['actions']); |
|
83 | + $this->profile[$name]['filters'] = array_add($this->profile[$name]['filters'], $item['filters']); |
|
84 | + $this->profile[$name]['queries'] = array_add($this->profile[$name]['queries'], $item['queries']); |
|
85 | 85 | #$this->_query_summary($item['queries'], $this->profile[$name]['queries']); |
86 | 86 | |
87 | 87 | } |
@@ -109,28 +109,28 @@ discard block |
||
109 | 109 | |
110 | 110 | function microtime($since = 0.0) { |
111 | 111 | list($usec, $sec) = explode(' ', microtime()); |
112 | - return (float)$sec + (float)$usec - $since; |
|
112 | + return (float) $sec + (float) $usec - $since; |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | function log_filter($tag) { |
116 | 116 | if ($this->stack) { |
117 | 117 | global $wp_actions; |
118 | 118 | if ($tag == end($wp_actions)) |
119 | - @$this->stack[count($this->stack)-1]['actions'][$tag] ++; |
|
119 | + @$this->stack[count($this->stack) - 1]['actions'][$tag]++; |
|
120 | 120 | else |
121 | - @$this->stack[count($this->stack)-1]['filters'][$tag] ++; |
|
121 | + @$this->stack[count($this->stack) - 1]['filters'][$tag]++; |
|
122 | 122 | } |
123 | 123 | return $arg; |
124 | 124 | } |
125 | 125 | |
126 | 126 | function log_action($tag) { |
127 | 127 | if ($this->stack) |
128 | - @$this->stack[count($this->stack)-1]['actions'][$tag] ++; |
|
128 | + @$this->stack[count($this->stack) - 1]['actions'][$tag]++; |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | function _current_action() { |
132 | 132 | global $wp_actions; |
133 | - return $wp_actions[count($wp_actions)-1]; |
|
133 | + return $wp_actions[count($wp_actions) - 1]; |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | function results() { |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | $sql = preg_replace('/(WHERE \w+ =) \d+/', '$1 x', $sql); |
144 | 144 | $sql = preg_replace('/(WHERE \w+ =) \'\[-\w]+\'/', '$1 \'xxx\'', $sql); |
145 | 145 | |
146 | - @$out[$sql] ++; |
|
146 | + @$out[$sql]++; |
|
147 | 147 | } |
148 | 148 | asort($out); |
149 | 149 | return; |
@@ -154,9 +154,9 @@ discard block |
||
154 | 154 | $out = array(); |
155 | 155 | foreach ($queries as $q) { |
156 | 156 | if (empty($q[2])) |
157 | - @$out['unknown'] ++; |
|
157 | + @$out['unknown']++; |
|
158 | 158 | else |
159 | - @$out[$q[2]] ++; |
|
159 | + @$out[$q[2]]++; |
|
160 | 160 | } |
161 | 161 | return $out; |
162 | 162 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (class_exists( 'WP_Image_Editor' ) ) : |
|
3 | +if (class_exists('WP_Image_Editor')) : |
|
4 | 4 | |
5 | 5 | class WP_Image_Editor_Mock extends WP_Image_Editor { |
6 | 6 | |
@@ -9,38 +9,38 @@ discard block |
||
9 | 9 | public static $save_return = array(); |
10 | 10 | |
11 | 11 | // Allow testing of jpeg_quality filter. |
12 | - public function set_mime_type( $mime_type = null ) { |
|
12 | + public function set_mime_type($mime_type = null) { |
|
13 | 13 | $this->mime_type = $mime_type; |
14 | 14 | } |
15 | 15 | |
16 | 16 | public function load() { |
17 | 17 | return self::$load_return; |
18 | 18 | } |
19 | - public static function test( $args = array() ) { |
|
19 | + public static function test($args = array()) { |
|
20 | 20 | return self::$test_return; |
21 | 21 | } |
22 | - public static function supports_mime_type( $mime_type ) { |
|
22 | + public static function supports_mime_type($mime_type) { |
|
23 | 23 | return true; |
24 | 24 | } |
25 | - public function resize( $max_w, $max_h, $crop = false ) { |
|
25 | + public function resize($max_w, $max_h, $crop = false) { |
|
26 | 26 | |
27 | 27 | } |
28 | - public function multi_resize( $sizes ) { |
|
28 | + public function multi_resize($sizes) { |
|
29 | 29 | |
30 | 30 | } |
31 | - public function crop( $src_x, $src_y, $src_w, $src_h, $dst_w = null, $dst_h = null, $src_abs = false ) { |
|
31 | + public function crop($src_x, $src_y, $src_w, $src_h, $dst_w = null, $dst_h = null, $src_abs = false) { |
|
32 | 32 | |
33 | 33 | } |
34 | - public function rotate( $angle ) { |
|
34 | + public function rotate($angle) { |
|
35 | 35 | |
36 | 36 | } |
37 | - public function flip( $horz, $vert ) { |
|
37 | + public function flip($horz, $vert) { |
|
38 | 38 | |
39 | 39 | } |
40 | - public function save( $destfilename = null, $mime_type = null ) { |
|
40 | + public function save($destfilename = null, $mime_type = null) { |
|
41 | 41 | return self::$save_return; |
42 | 42 | } |
43 | - public function stream( $mime_type = null ) { |
|
43 | + public function stream($mime_type = null) { |
|
44 | 44 | |
45 | 45 | } |
46 | 46 | } |
@@ -1,19 +1,19 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | abstract class WP_Test_REST_TestCase extends WP_UnitTestCase { |
4 | - protected function assertErrorResponse( $code, $response, $status = null ) { |
|
4 | + protected function assertErrorResponse($code, $response, $status = null) { |
|
5 | 5 | |
6 | - if ( is_a( $response, 'WP_REST_Response' ) ) { |
|
6 | + if (is_a($response, 'WP_REST_Response')) { |
|
7 | 7 | $response = $response->as_error(); |
8 | 8 | } |
9 | 9 | |
10 | - $this->assertInstanceOf( 'WP_Error', $response ); |
|
11 | - $this->assertEquals( $code, $response->get_error_code() ); |
|
10 | + $this->assertInstanceOf('WP_Error', $response); |
|
11 | + $this->assertEquals($code, $response->get_error_code()); |
|
12 | 12 | |
13 | - if ( null !== $status ) { |
|
13 | + if (null !== $status) { |
|
14 | 14 | $data = $response->get_error_data(); |
15 | - $this->assertArrayHasKey( 'status', $data ); |
|
16 | - $this->assertEquals( $status, $data['status'] ); |
|
15 | + $this->assertArrayHasKey('status', $data); |
|
16 | + $this->assertEquals($status, $data['status']); |
|
17 | 17 | } |
18 | 18 | } |
19 | 19 | } |
@@ -21,18 +21,18 @@ |
||
21 | 21 | * @param array $args Arguments to pass to the method |
22 | 22 | * @return mixed |
23 | 23 | */ |
24 | - public function __call( $method, $args ) { |
|
25 | - return call_user_func_array( array( $this, $method ), $args ); |
|
24 | + public function __call($method, $args) { |
|
25 | + return call_user_func_array(array($this, $method), $args); |
|
26 | 26 | } |
27 | 27 | |
28 | - public function send_header( $header, $value ) { |
|
29 | - $this->sent_headers[ $header ] = $value; |
|
28 | + public function send_header($header, $value) { |
|
29 | + $this->sent_headers[$header] = $value; |
|
30 | 30 | } |
31 | 31 | |
32 | - public function serve_request( $path = null ) { |
|
32 | + public function serve_request($path = null) { |
|
33 | 33 | |
34 | 34 | ob_start(); |
35 | - $result = parent::serve_request( $path ); |
|
35 | + $result = parent::serve_request($path); |
|
36 | 36 | $this->sent_body = ob_get_clean(); |
37 | 37 | return $result; |
38 | 38 | } |
@@ -16,14 +16,14 @@ |
||
16 | 16 | 's' => 'Longwood Gardens' |
17 | 17 | ); |
18 | 18 | |
19 | - $all_posts = new WP_Query( $query_args ); |
|
19 | + $all_posts = new WP_Query($query_args); |
|
20 | 20 | |
21 | 21 | $total_posts = $all_posts->found_posts; |
22 | 22 | |
23 | 23 | $this->assertTrue(is_int((int) $total_posts)); |
24 | 24 | |
25 | 25 | $title = null; |
26 | - while ( $all_posts->have_posts() ) : $all_posts->the_post(); |
|
26 | + while ($all_posts->have_posts()) : $all_posts->the_post(); |
|
27 | 27 | $title = get_the_title(); |
28 | 28 | endwhile; |
29 | 29 |
@@ -15,8 +15,8 @@ discard block |
||
15 | 15 | geodir_user_signup(); |
16 | 16 | remove_filter('wp_redirect', '__return_false'); |
17 | 17 | $errors = (array) $errors; |
18 | - $this->assertArrayHasKey( 'empty_password', $errors["errors"] ); |
|
19 | - $this->assertContains( 'The password field is empty', $errors["errors"]["empty_password"][0] ); |
|
18 | + $this->assertArrayHasKey('empty_password', $errors["errors"]); |
|
19 | + $this->assertContains('The password field is empty', $errors["errors"]["empty_password"][0]); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | public function testLoginBoxIncorrectPassword() |
@@ -30,8 +30,8 @@ discard block |
||
30 | 30 | geodir_user_signup(); |
31 | 31 | remove_filter('wp_redirect', '__return_false'); |
32 | 32 | $errors = (array) $errors; |
33 | - $this->assertArrayHasKey( 'incorrect_password', $errors["errors"] ); |
|
34 | - $this->assertContains( 'The password you entered for the username', $errors["errors"]["incorrect_password"][0] ); |
|
33 | + $this->assertArrayHasKey('incorrect_password', $errors["errors"]); |
|
34 | + $this->assertContains('The password you entered for the username', $errors["errors"]["incorrect_password"][0]); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | public function testLoginBoxInvalidUsername() |
@@ -45,8 +45,8 @@ discard block |
||
45 | 45 | geodir_user_signup(); |
46 | 46 | remove_filter('wp_redirect', '__return_false'); |
47 | 47 | $errors = (array) $errors; |
48 | - $this->assertArrayHasKey( 'invalid_username', $errors["errors"] ); |
|
49 | - $this->assertContains( 'Invalid username', $errors["errors"]["invalid_username"][0] ); |
|
48 | + $this->assertArrayHasKey('invalid_username', $errors["errors"]); |
|
49 | + $this->assertContains('Invalid username', $errors["errors"]["invalid_username"][0]); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | public function tearDown() |
@@ -16,8 +16,8 @@ discard block |
||
16 | 16 | geodir_user_signup(); |
17 | 17 | remove_filter('wp_redirect', '__return_false'); |
18 | 18 | $errors = (array) $errors; |
19 | - $this->assertArrayHasKey( 'empty_password', $errors["errors"] ); |
|
20 | - $this->assertContains( 'The password field is empty', $errors["errors"]["empty_password"][0] ); |
|
19 | + $this->assertArrayHasKey('empty_password', $errors["errors"]); |
|
20 | + $this->assertContains('The password field is empty', $errors["errors"]["empty_password"][0]); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | public function testLoginIncorrectPassword() |
@@ -30,8 +30,8 @@ discard block |
||
30 | 30 | geodir_user_signup(); |
31 | 31 | remove_filter('wp_redirect', '__return_false'); |
32 | 32 | $errors = (array) $errors; |
33 | - $this->assertArrayHasKey( 'incorrect_password', $errors["errors"] ); |
|
34 | - $this->assertContains( 'The password you entered for the username', $errors["errors"]["incorrect_password"][0] ); |
|
33 | + $this->assertArrayHasKey('incorrect_password', $errors["errors"]); |
|
34 | + $this->assertContains('The password you entered for the username', $errors["errors"]["incorrect_password"][0]); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | public function testLoginInvalidUsername() |
@@ -44,8 +44,8 @@ discard block |
||
44 | 44 | geodir_user_signup(); |
45 | 45 | remove_filter('wp_redirect', '__return_false'); |
46 | 46 | $errors = (array) $errors; |
47 | - $this->assertArrayHasKey( 'invalid_username', $errors["errors"] ); |
|
48 | - $this->assertContains( 'Invalid username', $errors["errors"]["invalid_username"][0] ); |
|
47 | + $this->assertArrayHasKey('invalid_username', $errors["errors"]); |
|
48 | + $this->assertContains('Invalid username', $errors["errors"]["invalid_username"][0]); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | // public function testLoginValid() |
@@ -70,8 +70,8 @@ discard block |
||
70 | 70 | geodir_user_signup(); |
71 | 71 | remove_filter('wp_redirect', '__return_false'); |
72 | 72 | $errors = (array) $errors; |
73 | - $this->assertArrayHasKey( 'empty_username', $errors["errors"] ); |
|
74 | - $this->assertContains( 'Enter a username or e-mail address', $errors["errors"]["empty_username"][0] ); |
|
73 | + $this->assertArrayHasKey('empty_username', $errors["errors"]); |
|
74 | + $this->assertContains('Enter a username or e-mail address', $errors["errors"]["empty_username"][0]); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | public function testForgotPassInvalidEmail() |
@@ -85,8 +85,8 @@ discard block |
||
85 | 85 | geodir_user_signup(); |
86 | 86 | remove_filter('wp_redirect', '__return_false'); |
87 | 87 | $errors = (array) $errors; |
88 | - $this->assertArrayHasKey( 'invalid_email', $errors["errors"] ); |
|
89 | - $this->assertContains( 'There is no user registered with that email address', $errors["errors"]["invalid_email"][0] ); |
|
88 | + $this->assertArrayHasKey('invalid_email', $errors["errors"]); |
|
89 | + $this->assertContains('There is no user registered with that email address', $errors["errors"]["invalid_email"][0]); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | public function testForgotPassInvalidUsername() |
@@ -100,8 +100,8 @@ discard block |
||
100 | 100 | geodir_user_signup(); |
101 | 101 | remove_filter('wp_redirect', '__return_false'); |
102 | 102 | $errors = (array) $errors; |
103 | - $this->assertArrayHasKey( 'invalidcombo', $errors["errors"] ); |
|
104 | - $this->assertContains( 'Invalid username or e-mail', $errors["errors"]["invalidcombo"][0] ); |
|
103 | + $this->assertArrayHasKey('invalidcombo', $errors["errors"]); |
|
104 | + $this->assertContains('Invalid username or e-mail', $errors["errors"]["invalidcombo"][0]); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | public function tearDown() |
@@ -15,9 +15,9 @@ |
||
15 | 15 | 'posts_per_page' => 1, |
16 | 16 | ); |
17 | 17 | |
18 | - $all_posts = new WP_Query( $query_args ); |
|
18 | + $all_posts = new WP_Query($query_args); |
|
19 | 19 | $post_id = null; |
20 | - while ( $all_posts->have_posts() ) : $all_posts->the_post(); |
|
20 | + while ($all_posts->have_posts()) : $all_posts->the_post(); |
|
21 | 21 | $post_id = get_the_ID(); |
22 | 22 | endwhile; |
23 | 23 |