Skip to content

Commit 7525103

Browse files
committed
test ConstantStringType->isCallable()
1 parent 8139b0c commit 7525103

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

tests/PHPStan/Type/Constant/ConstantStringTypeTest.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,4 +185,21 @@ public function testSetInvalidValue(): void
185185
$this->assertInstanceOf(ErrorType::class, $result);
186186
}
187187

188+
#[DataProvider('dataIsCallable')]
189+
public function testIsCallable(TrinaryLogic $trinaryLogic, string $constantValue): void
190+
{
191+
$this->assertSame(
192+
$trinaryLogic,
193+
(new ConstantStringType($constantValue))->isCallable()
194+
);
195+
}
196+
197+
public static function dataIsCallable(): iterable
198+
{
199+
yield [TrinaryLogic::createNo(), ''];
200+
yield [TrinaryLogic::createNo(), '0'];
201+
yield [TrinaryLogic::createYes(), 'substr'];
202+
yield [TrinaryLogic::createYes(), self::class.'::dataIsCallable'];
203+
yield [TrinaryLogic::createMaybe(), self::class.'::methodDoesNotExist'];
204+
}
188205
}

0 commit comments

Comments
 (0)