/
dimamir
/
Wsdl_PackageGenerator
Обзор
Документация
Войти
/
dimamir
/
Wsdl_PackageGenerator
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
tests/File/Validation/MinExclusiveRuleTest.php
66 строк
2 KB
Mikaël DELSOL
Add Rector PHP to ease code improvement (#281)
01 апр 2023, 23:07
Не верифицирован
01 апр 2023, 23:07
801ec3f
Код
Авторство
О чём код?
<?php declare(strict_types=1); namespace WsdlToPhp\PackageGenerator\Tests\File\Validation; use WsdlToPhp\PackageGenerator\File\Validation\MinExclusiveRule; /** * @internal * @coversDefaultClass */ final class MinExclusiveRuleTest extends AbstractRule { public function testApplyRuleWithExactSameValue(): void { $this->expectException(\InvalidArgumentException::class); $functionName = parent::createRuleFunction(MinExclusiveRule::class, 2); call_user_func($functionName, 2); } public function testApplyRuleWithGreaterValue(): void { $functionName = parent::createRuleFunction(MinExclusiveRule::class, 2); $this->assertTrue(call_user_func($functionName, 2.1)); } public function testApplyRuleWithLowerValue(): void { $this->expectException(\InvalidArgumentException::class); $functionName = parent::createRuleFunction(MinExclusiveRule::class, 2); call_user_func($functionName, 1.99); } public function testApplyRuleWithNull(): void { $functionName = parent::createRuleFunction(MinExclusiveRule::class, 2); $this->assertTrue(call_user_func($functionName, null)); } public function testApplyRuleWithDateIntervalMustBeFalseWithLowerInterval(): void { $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage('Invalid value \'-P10675199DT2H49M6.4775807S\', the value must be chronologically greater than -P10675199DT2H49M5.4775807S'); $functionName = parent::createRuleFunction(MinExclusiveRule::class, '-P10675199DT2H49M5.4775807S'); $this->assertTrue(call_user_func($functionName, '-P10675199DT2H49M6.4775807S')); } public function testApplyRuleWithDateIntervalMustBeFalseWithSameInterval(): void { $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage('Invalid value \'-P10675199DT2H49M5.4775807S\', the value must be chronologically greater than -P10675199DT2H49M5.4775807S'); $functionName = parent::createRuleFunction(MinExclusiveRule::class, $interval = '-P10675199DT2H49M5.4775807S'); $this->assertTrue(call_user_func($functionName, $interval)); } public function testApplyRuleWithDateIntervalMustBeTrueWthHigherInterval(): void { $functionName = parent::createRuleFunction(MinExclusiveRule::class, '-P10675199DT2H49M5.4775807S'); $this->assertTrue(call_user_func($functionName, '-P10675199DT2H49M4.4775807S')); } }