Skip to content

Commit a5743b4

Browse files
committed
Added more Dredd hooks to code
1 parent d1dc89b commit a5743b4

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/Kernel.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public function run()
1717

1818
public function __call($method, $args)
1919
{
20-
if (in_array($method, ['beforeAll', 'beforeEach'])) {
20+
if (in_array($method, ['beforeAll', 'beforeEach', 'beforeEachValidation', 'afterEach', 'afterAll'])) {
2121
$callable = $this->resolveArgument($args[0]);
2222

2323
Hooks::$method(function (&$transaction) use ($callable) {
@@ -26,5 +26,15 @@ public function __call($method, $args)
2626
$transaction = $transactionObject->getTransaction();
2727
});
2828
}
29+
30+
if (in_array($method, ['before', 'beforeValidation', 'after'])) {
31+
$callable = $this->resolveArgument($args[1]);
32+
33+
Hooks::$method($args[0], function (&$transaction) use ($callable) {
34+
$transactionObject = new Transaction($transaction);
35+
$callable($transactionObject);
36+
$transaction = $transactionObject->getTransaction();
37+
});
38+
}
2939
}
30-
}
40+
}

0 commit comments

Comments
 (0)