1 | <?php // phpcs:ignore WordPress.Files.FileName |
||
12 | class Test_Latest_Autoloader_Guard extends TestCase { |
||
13 | |||
14 | /** |
||
15 | * The mock Plugins_Handler instance. |
||
16 | * |
||
17 | * @var Plugins_Handler|\PHPUnit\Framework\MockObject\MockObject |
||
18 | */ |
||
19 | private $plugins_handler; |
||
20 | |||
21 | /** |
||
22 | * The mock Autoloader_Handler instance. |
||
23 | * |
||
24 | * @var Autoloader_Handler|\PHPUnit\Framework\MockObject\MockObject |
||
25 | */ |
||
26 | private $autoloader_handler; |
||
27 | |||
28 | /** |
||
29 | * The mock Autoloader_Locator instance. |
||
30 | * |
||
31 | * @var Autoloader_Locator|\PHPUnit\Framework\MockObject\MockObject |
||
32 | */ |
||
33 | private $autoloader_locator; |
||
34 | |||
35 | /** |
||
36 | * The class we're testing. |
||
37 | * |
||
38 | * @var Latest_Autoloader_Guard |
||
39 | */ |
||
40 | private $guard; |
||
41 | |||
42 | /** |
||
43 | * Setup runs before each test. |
||
44 | * |
||
45 | * @before |
||
46 | */ |
||
47 | public function set_up() { |
||
48 | $this->plugins_handler = $this->getMockBuilder( Plugins_Handler::class ) |
||
49 | ->disableOriginalConstructor() |
||
50 | ->getMock(); |
||
51 | $this->autoloader_handler = $this->getMockBuilder( Autoloader_Handler::class ) |
||
52 | ->disableOriginalConstructor() |
||
53 | ->getMock(); |
||
54 | $this->autoloader_locator = $this->getMockBuilder( Autoloader_Locator::class ) |
||
55 | ->disableOriginalConstructor() |
||
56 | ->getMock(); |
||
57 | |||
58 | $this->guard = new Latest_Autoloader_Guard( |
||
59 | $this->plugins_handler, |
||
60 | $this->autoloader_handler, |
||
61 | $this->autoloader_locator |
||
62 | ); |
||
63 | } |
||
64 | |||
65 | /** |
||
66 | * Tests that the guard stops initialization when the autoloader has already initialized. |
||
67 | * |
||
68 | * @runInSeparateProcess |
||
69 | * @preserveGlobalState disabled |
||
70 | */ |
||
71 | public function test_should_stop_init_when_autoloader_already_initialized() { |
||
82 | |||
83 | /** |
||
84 | * Tests that the guard stops initialization when not the latest autoloader. |
||
85 | */ |
||
86 | public function test_should_stop_init_when_not_latest_autoloader() { |
||
102 | |||
103 | /** |
||
104 | * Tests that the guard allows initialization when the latest. |
||
105 | */ |
||
106 | public function test_should_allow_init_when_latest() { |
||
120 | |||
121 | /** |
||
122 | * Tests that the guard resets when plugins have changed. |
||
123 | */ |
||
124 | public function test_should_stop_init_should_reset_when_plugins_change() { |
||
139 | } |
||
140 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.