Skip to content

Commit 883acb0

Browse files
committed
refactor: change notation type in methods
The notation type in the test function names has been changed from camel to snake case for readability. Closes #4
1 parent 42c9dd6 commit 883acb0

8 files changed

Lines changed: 96 additions & 80 deletions

tests/ActionClassTest.php

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
<?php
22

33
/*
4-
* This file is part of https://github.com/josantonius/php-hook repository.
5-
*
6-
* (c) Josantonius <hello@josantonius.dev>
7-
*
8-
* For the full copyright and license information, please view the LICENSE
9-
* file that was distributed with this source code.
10-
*/
4+
* This file is part of https://github.com/josantonius/php-hook repository.
5+
*
6+
* (c) Josantonius <hello@josantonius.dev>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*
11+
* @phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
12+
*/
1113

1214
namespace Josantonius\Hook\Tests\Hook;
1315

@@ -31,27 +33,27 @@ public function setUp(): void
3133
$this->action = new Action($this->foo->bar(...), Priority::NORMAL, once: false);
3234
}
3335

34-
public function testShouldGetCallback(): void
36+
public function test_should_get_callback(): void
3537
{
3638
$this->assertEquals($this->foo->bar(...), $this->action->getCallback());
3739
}
3840

39-
public function testShouldGetPriority(): void
41+
public function test_should_get_priority(): void
4042
{
4143
$this->assertEquals(Priority::NORMAL, $this->action->getPriority());
4244
}
4345

44-
public function testShouldGetResult(): void
46+
public function test_should_get_result(): void
4547
{
4648
$this->assertNull($this->action->getResult());
4749
}
4850

49-
public function testShouldCheckIfItRunsOnce(): void
51+
public function test_should_check_if_it_runs_once(): void
5052
{
5153
$this->assertFalse($this->action->isOnce());
5254
}
5355

54-
public function testShouldCheckIfWasDone(): void
56+
public function test_should_check_if_was_done(): void
5557
{
5658
$this->assertFalse($this->action->wasDone());
5759

@@ -60,7 +62,7 @@ public function testShouldCheckIfWasDone(): void
6062
$this->assertTrue($this->action->wasDone());
6163
}
6264

63-
public function testShouldSetTheResultAfterRunCallback(): void
65+
public function test_should_set_the_result_after_run_callback(): void
6466
{
6567
$this->action->runCallback('foo');
6668

tests/Hook/AddActionMethodTest.php

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
<?php
22

33
/*
4-
* This file is part of https://github.com/josantonius/php-hook repository.
5-
*
6-
* (c) Josantonius <hello@josantonius.dev>
7-
*
8-
* For the full copyright and license information, please view the LICENSE
9-
* file that was distributed with this source code.
10-
*/
4+
* This file is part of https://github.com/josantonius/php-hook repository.
5+
*
6+
* (c) Josantonius <hello@josantonius.dev>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*
11+
* @phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
12+
*/
1113

1214
namespace Josantonius\Hook\Tests\Hook;
1315

@@ -32,7 +34,7 @@ public function setUp(): void
3234
$this->hook = new Hook('foo');
3335
}
3436

35-
public function testShouldAddActionWithDefaultPriority(): void
37+
public function test_should_add_action_with_default_priority(): void
3638
{
3739
$action = $this->hook->addAction($this->foo->bar(...));
3840

@@ -51,7 +53,7 @@ public function testShouldAddActionWithDefaultPriority(): void
5153
$this->assertSame(Priority::NORMAL, $action->getPriority());
5254
}
5355

54-
public function testShouldAddActionWithCustomPriority(): void
56+
public function test_should_add_action_with_custom_priority(): void
5557
{
5658
$action = $this->hook->addAction($this->foo->bar(...), Priority::HIGH);
5759

tests/Hook/AddActionOnceMethodTest.php

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
<?php
22

33
/*
4-
* This file is part of https://github.com/josantonius/php-hook repository.
5-
*
6-
* (c) Josantonius <hello@josantonius.dev>
7-
*
8-
* For the full copyright and license information, please view the LICENSE
9-
* file that was distributed with this source code.
10-
*/
4+
* This file is part of https://github.com/josantonius/php-hook repository.
5+
*
6+
* (c) Josantonius <hello@josantonius.dev>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*
11+
* @phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
12+
*/
1113

1214
namespace Josantonius\Hook\Tests\Hook;
1315

@@ -32,7 +34,7 @@ public function setUp(): void
3234
$this->hook = new Hook('bar');
3335
}
3436

35-
public function testShouldAddActionWithDefaultPriority(): void
37+
public function test_should_add_action_with_default_priority(): void
3638
{
3739
$action = $this->hook->addActionOnce($this->foo->bar(...));
3840

@@ -51,7 +53,7 @@ public function testShouldAddActionWithDefaultPriority(): void
5153
$this->assertSame(Priority::NORMAL, $action->getPriority());
5254
}
5355

54-
public function testShouldAddActionWithCustomPriority(): void
56+
public function test_should_add_action_with_custom_priority(): void
5557
{
5658
$action = $this->hook->addActionOnce($this->foo->bar(...), Priority::HIGH);
5759

tests/Hook/DoActionsMethodTest.php

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
<?php
22

33
/*
4-
* This file is part of https://github.com/josantonius/php-hook repository.
5-
*
6-
* (c) Josantonius <hello@josantonius.dev>
7-
*
8-
* For the full copyright and license information, please view the LICENSE
9-
* file that was distributed with this source code.
10-
*/
4+
* This file is part of https://github.com/josantonius/php-hook repository.
5+
*
6+
* (c) Josantonius <hello@josantonius.dev>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*
11+
* @phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
12+
*/
1113

1214
namespace Josantonius\Hook\Tests\Hook;
1315

@@ -32,14 +34,14 @@ public function setUp(): void
3234
$this->hook = new Hook('foo_hook');
3335
}
3436

35-
public function testShouldFailIfNoActionsWereAdded(): void
37+
public function test_should_fail_if_no_actions_were_added(): void
3638
{
3739
$this->expectException(HookException::class);
3840

3941
$this->hook->doActions();
4042
}
4143

42-
public function testShouldDoActionsWithoutArguments(): void
44+
public function test_should_do_actions_without_arguments(): void
4345
{
4446
$fooHook = new Hook('foo_hook');
4547
$barHook = new Hook('bar_hook');
@@ -64,7 +66,7 @@ public function testShouldDoActionsWithoutArguments(): void
6466
$this->assertEmpty($action3->getResult()->arguments);
6567
}
6668

67-
public function testShouldDoActionsWithArguments(): void
69+
public function test_should_do_actions_with_arguments(): void
6870
{
6971
$fooHook = new Hook('foo_hook');
7072
$barHook = new Hook('bar_hook');
@@ -89,7 +91,7 @@ public function testShouldDoActionsWithArguments(): void
8991
$this->assertEquals(['bar', 'foo'], $action3->getResult()->arguments);
9092
}
9193

92-
public function testShouldKeepTheActionIfWasSetWithAddAction(): void
94+
public function test_should_keep_the_action_if_was_set_with_add_action(): void
9395
{
9496
$hook = new Hook('user_hook');
9597

@@ -102,7 +104,7 @@ public function testShouldKeepTheActionIfWasSetWithAddAction(): void
102104
$this->assertCount(1, $actions);
103105
}
104106

105-
public function testShouldRemoveTheActionIfWasSetWithAddActionOnce(): void
107+
public function test_should_remove_the_action_if_was_set_with_add_action_once(): void
106108
{
107109
$hook = new Hook('login_hook');
108110

@@ -115,7 +117,7 @@ public function testShouldRemoveTheActionIfWasSetWithAddActionOnce(): void
115117
$this->assertCount(0, $actions);
116118
}
117119

118-
public function testShouldReturnAnArrayWithTheActionsDone(): void
120+
public function test_should_return_an_array_with_the_actions_done(): void
119121
{
120122
$hook = new Hook('logout_hook');
121123

@@ -132,7 +134,7 @@ public function testShouldReturnAnArrayWithTheActionsDone(): void
132134
$this->assertSame($actions[2], $action3);
133135
}
134136

135-
public function testShouldMarkTheHookAsDone(): void
137+
public function test_should_mark_the_hook_as_done(): void
136138
{
137139
$hook = new Hook('called_hook');
138140

@@ -145,7 +147,7 @@ public function testShouldMarkTheHookAsDone(): void
145147
$this->assertTrue($hooks['called_hook']['done']);
146148
}
147149

148-
public function testShouldFailIfTheActionsAreDoneOnceAndHaveAlreadyBeenDone(): void
150+
public function test_should_fail_if_the_actions_are_done_once_and_have_already_been_done(): void
149151
{
150152
$this->expectException(HookException::class);
151153

@@ -158,7 +160,7 @@ public function testShouldFailIfTheActionsAreDoneOnceAndHaveAlreadyBeenDone(): v
158160
$hook->doActions();
159161
}
160162

161-
public function testShouldDoActionsAccordingToTheirOrderOfEntryWhenHasSamePriority(): void
163+
public function test_should_do_actions_according_to_their_entry_order_with_same_priority(): void
162164
{
163165
$this->foo->clearHistory();
164166

@@ -174,7 +176,7 @@ public function testShouldDoActionsAccordingToTheirOrderOfEntryWhenHasSamePriori
174176
$this->assertEquals(['one', 'two', 'three', 'four'], $this->foo->getHistory());
175177
}
176178

177-
public function testShouldDoActionsAccordingToTheirPriorityLevel(): void
179+
public function test_should_do_actions_according_to_their_priority_level(): void
178180
{
179181
$this->foo->clearHistory();
180182

tests/Hook/GetNameMethodTest.php

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
<?php
22

33
/*
4-
* This file is part of https://github.com/josantonius/php-hook repository.
5-
*
6-
* (c) Josantonius <hello@josantonius.dev>
7-
*
8-
* For the full copyright and license information, please view the LICENSE
9-
* file that was distributed with this source code.
10-
*/
4+
* This file is part of https://github.com/josantonius/php-hook repository.
5+
*
6+
* (c) Josantonius <hello@josantonius.dev>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*
11+
* @phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
12+
*/
1113

1214
namespace Josantonius\Hook\Tests\Hook;
1315

@@ -25,7 +27,7 @@ public function setUp(): void
2527
$this->hook = new Hook('foo');
2628
}
2729

28-
public function testShouldGetHookName(): void
30+
public function test_should_get_hook_name(): void
2931
{
3032
$this->assertEquals('foo', $this->hook->getName());
3133
}

tests/Hook/HasActionsMethodTest.php

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
<?php
22

33
/*
4-
* This file is part of https://github.com/josantonius/php-hook repository.
5-
*
6-
* (c) Josantonius <hello@josantonius.dev>
7-
*
8-
* For the full copyright and license information, please view the LICENSE
9-
* file that was distributed with this source code.
10-
*/
4+
* This file is part of https://github.com/josantonius/php-hook repository.
5+
*
6+
* (c) Josantonius <hello@josantonius.dev>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*
11+
* @phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
12+
*/
1113

1214
namespace Josantonius\Hook\Tests\Hook;
1315

@@ -29,7 +31,7 @@ public function setUp(): void
2931
$this->hook = new Hook('user_register');
3032
}
3133

32-
public function testShouldCheckIfHookHasActions(): void
34+
public function test_should_check_if_hook_has_actions(): void
3335
{
3436
$this->assertFalse($this->hook->hasActions());
3537

tests/Hook/HasDoneActionsMethodTest.php

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
<?php
22

33
/*
4-
* This file is part of https://github.com/josantonius/php-hook repository.
5-
*
6-
* (c) Josantonius <hello@josantonius.dev>
7-
*
8-
* For the full copyright and license information, please view the LICENSE
9-
* file that was distributed with this source code.
10-
*/
4+
* This file is part of https://github.com/josantonius/php-hook repository.
5+
*
6+
* (c) Josantonius <hello@josantonius.dev>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*
11+
* @phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
12+
*/
1113

1214
namespace Josantonius\Hook\Tests\Hook;
1315

@@ -29,7 +31,7 @@ public function setUp(): void
2931
$this->hook = new Hook('test_hook');
3032
}
3133

32-
public function testShouldCheckIfActionsWereDoneOnTheHook(): void
34+
public function test_should_check_if_actions_were_done_on_the_hook(): void
3335
{
3436
$this->hook->addAction($this->foo->bar(...));
3537

tests/Hook/HasUndoneActionsMethodTest.php

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
<?php
22

33
/*
4-
* This file is part of https://github.com/josantonius/php-hook repository.
5-
*
6-
* (c) Josantonius <hello@josantonius.dev>
7-
*
8-
* For the full copyright and license information, please view the LICENSE
9-
* file that was distributed with this source code.
10-
*/
4+
* This file is part of https://github.com/josantonius/php-hook repository.
5+
*
6+
* (c) Josantonius <hello@josantonius.dev>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*
11+
* @phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
12+
*/
1113

1214
namespace Josantonius\Hook\Tests\Hook;
1315

@@ -29,7 +31,7 @@ public function setUp(): void
2931
$this->hook = new Hook('user_delete');
3032
}
3133

32-
public function testShouldCheckIfHookHasUndoneActions(): void
34+
public function test_should_check_if_hook_has_undone_actions(): void
3335
{
3436
$this->assertFalse($this->hook->hasUndoneActions());
3537

0 commit comments

Comments
 (0)