Skip to content

Commit 03ed5e9

Browse files
committed
test: fix failing tests
1 parent cd00d60 commit 03ed5e9

File tree

5 files changed

+29
-14
lines changed

5 files changed

+29
-14
lines changed

php/WP_Mock/Action.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ protected function get_strict_mode_message()
6262
}
6363
}
6464

65-
class Action_Responder
65+
class Action_Responder extends Responder
6666
{
6767
/**
6868
* @var mixed

php/WP_Mock/Filter.php

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ public function apply($args)
4949
return call_user_func_array(array($processors, 'send'), $args);
5050
}
5151

52+
/**
53+
* @return Filter_Responder
54+
*/
5255
protected function new_responder()
5356
{
5457
return new Filter_Responder();
@@ -63,7 +66,7 @@ protected function get_strict_mode_message()
6366
}
6467

6568
/**
66-
* @return Filter_Responder
69+
* @return Action_Responder|Filter_Responder|HookedCallbackResponder
6770
*/
6871
public function withAnything()
6972
{
@@ -74,18 +77,8 @@ public function withAnything()
7477
}
7578
}
7679

77-
class Filter_Responder
80+
class Filter_Responder extends Responder
7881
{
79-
/**
80-
* @var mixed
81-
*/
82-
protected $value;
83-
84-
public function reply($value)
85-
{
86-
$this->value = $value;
87-
}
88-
8982
public function send()
9083
{
9184
if ($this->value instanceof InvokedFilterValue) {

php/WP_Mock/HookedCallback.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ protected function get_strict_mode_message()
9696
}
9797
}
9898

99-
class HookedCallbackResponder
99+
class HookedCallbackResponder extends Responder
100100
{
101101
/**
102102
* @var callable

php/WP_Mock/Responder.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
namespace WP_Mock;
4+
5+
abstract class Responder
6+
{
7+
/**
8+
* @var mixed
9+
*/
10+
protected $value;
11+
12+
/**
13+
* @param mixed $value
14+
* @return void
15+
*/
16+
public function reply($value)
17+
{
18+
$this->value = $value;
19+
}
20+
}

tests/Unit/WP_MockTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,7 @@ public function testCanGetDeprecatedMethodListener(): void
320320
* @preserveGlobalState disabled
321321
*
322322
* @return void
323+
* @throws Exception|InvalidArgumentException
323324
*/
324325
public function testOnFilterPasses(): void
325326
{
@@ -343,6 +344,7 @@ public function testOnFilterPasses(): void
343344
* @preserveGlobalState disabled
344345
*
345346
* @return void
347+
* @throws Exception|InvalidArgumentException
346348
*/
347349
public function testOnFilterPassesWithAnything(): void
348350
{

0 commit comments

Comments
 (0)