. */ namespace SP\Tests\Util; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SP\Util\Chainable; /** * Class ChainableTest * */ #[Group('unitary')] class ChainableTest extends TestCase { public function testNext() { $chain = (new Chainable(fn($n) => $this->increment($n, 1), $this, 1)) ->next(fn($n) => $this->increment($n, 2)) ->next(fn($n) => $this->increment($n, 3)) ->resolve(); $this->assertEquals(7, $chain); } private function increment(int $a, int $b): int { return $a + $b; } }