Skip to content

Commit 47bc051

Browse files
author
Luke
committed
Add test that ink works when it is callable.
1 parent b297120 commit 47bc051

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tests/ArrayRedactorTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,16 @@ public function can_omit_constructor_arguments_in_favor_of_methods()
9494
'password' => null
9595
]), $result);
9696
}
97+
98+
/** @test */
99+
public function can_accept_closure_in_ink()
100+
{
101+
$array = $this->content;
102+
$result = (new ArrayRedactor())->content($this->content)->keys(['email'])->ink(function() use ($array) {
103+
return substr($array['email'], stripos($array['email'], '@'));
104+
})->redact();
105+
$this->assertEquals(array_merge($this->content, [
106+
'email' => '@gmail.com'
107+
]), $result);
108+
}
97109
}

0 commit comments

Comments
 (0)