OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
reader
/
API
/
vendor
/
symfony
/
finder
/
Tests
/
Comparator
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
08/07/2024 04:34:19 AM
rwxr-xr-x
📄
ComparatorTest.php
2.09 KB
08/07/2024 04:34:19 AM
rw-r--r--
📄
DateComparatorTest.php
2.36 KB
08/07/2024 04:34:19 AM
rw-r--r--
📄
NumberComparatorTest.php
3.42 KB
08/07/2024 04:34:19 AM
rw-r--r--
Editing: ComparatorTest.php
Close
<?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Finder\Tests\Comparator; use PHPUnit\Framework\TestCase; use Symfony\Component\Finder\Comparator\Comparator; class ComparatorTest extends TestCase { public function testInvalidOperator() { $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage('Invalid operator "foo".'); new Comparator('some target', 'foo'); } /** * @dataProvider provideMatches */ public function testTestSucceeds(string $operator, string $target, string $testedValue) { $c = new Comparator($target, $operator); $this->assertSame($target, $c->getTarget()); $this->assertSame($operator, $c->getOperator()); $this->assertTrue($c->test($testedValue)); } public static function provideMatches(): array { return [ ['<', '1000', '500'], ['<', '1000', '999'], ['<=', '1000', '999'], ['!=', '1000', '999'], ['<=', '1000', '1000'], ['==', '1000', '1000'], ['>=', '1000', '1000'], ['>=', '1000', '1001'], ['>', '1000', '1001'], ['>', '1000', '5000'], ]; } /** * @dataProvider provideNonMatches */ public function testTestFails(string $operator, string $target, string $testedValue) { $c = new Comparator($target, $operator); $this->assertFalse($c->test($testedValue)); } public static function provideNonMatches(): array { return [ ['>', '1000', '500'], ['>=', '1000', '500'], ['>', '1000', '1000'], ['!=', '1000', '1000'], ['<', '1000', '1000'], ['<', '1000', '1500'], ['<=', '1000', '1500'], ]; } }