You won't find a better Self-Sealing Callable in this sector!
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
679 B

<?php
/**
* @license MIT
* Copyright 2024 Dustin Wilson, et al.
* See LICENSE and AUTHORS files for details
*/
declare(strict_types=1);
namespace MensBeam\SelfSealingCallable\Test;
use MensBeam\SelfSealingCallable;
use PHPUnit\Framework\{
TestCase,
Attributes\CoversClass,
Attributes\DataProvider
};
#[CoversClass('MensBeam\SelfSealingCallable')]
class TestSelfSealingCallable extends TestCase {
public function testInvocation(): void {
$c = new SelfSealingCallable(fn() => 'ook');
$this->assertSame('ook', $c());
$c->disable();
$this->assertFalse($c());
$c->enable();
$this->assertSame('ook', $c());
}
}