* * Full license available in separate LICENSE file */ use Kadet\Functional as f; use Kadet\Functional\Collections as c; use Kadet\Functional\Predicates as p; /** * The library's own callables (predicates, pipes, decorators) used as collection callbacks. */ class LibraryCallablesTest extends \PHPUnit\Framework\TestCase { // negated predicates public function testFilterWithNegatedInternalFunction() { $this->assertSame([1 => 'x'], c\filter(f\not(is_numeric(...)))(['1', 'x'])); } public function testFilterWithNegatedClosure() { $this->assertSame([1], c\filter(f\not(fn ($x) => $x > 1))([1, 2])); } public function testFilterWithNegatedPredicateMethod() { $this->assertSame([1], c\filter(p\gt(1)->not())([1, 2])); } public function testRejectWithNegatedPredicate() { $this->assertSame([1 => 2], c\reject(p\gt(1)->not())([1, 2])); } }