Skip to content

Commit 6bbb568

Browse files
test: update unit tests for CLI refactor and improve code formatting
- Remove obsolete CLI initialization tests after refactoring - Update test formatting to follow consistent style guidelines - Add test for CLI initialization hook integration - Fix array formatting and method call spacing - Remove redundant test code for deprecated CLI constructor
1 parent e8786b9 commit 6bbb568

3 files changed

Lines changed: 182 additions & 169 deletions

File tree

test/unit/TinyCliTest.php

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -13,46 +13,6 @@ public function set_up()
1313
parent::set_up();
1414
}
1515

16-
public function test_will_register_command_on_cli_init_hook()
17-
{
18-
$this->wp->defaults();
19-
20-
if (!defined('WP_CLI')) {
21-
define('WP_CLI', true);
22-
}
23-
24-
$tiny_cli = new Tiny_Cli(null);
25-
26-
$add_action_calls = $this->wp->getCalls('add_action');
27-
$cli_init_found = false;
28-
29-
foreach ($add_action_calls as $call) {
30-
if ($call[0] === 'cli_init' && $call[1] === array($tiny_cli, 'register_command')) {
31-
$cli_init_found = true;
32-
break;
33-
}
34-
}
35-
36-
$this->assertTrue($cli_init_found, 'register_command should be hooked to cli_init');
37-
}
38-
39-
public function test_will_not_hook_if_cli_is_unavailable()
40-
{
41-
$this->wp->defaults();
42-
43-
$add_action_calls = $this->wp->getCalls('add_action');
44-
$cli_init_found = false;
45-
46-
foreach ($add_action_calls as $call) {
47-
if ($call[0] === 'cli_init') {
48-
$cli_init_found = true;
49-
break;
50-
}
51-
}
52-
53-
$this->assertFalse($cli_init_found, 'No cli_init hooks should be registered when WP_CLI is not available');
54-
}
55-
5616
public function test_will_compress_attachments_given_in_params()
5717
{
5818
$this->wp->stub('get_post_mime_type', function ($i) {

0 commit comments

Comments
 (0)