* * 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\DateComparator; class DateComparatorTest extends TestCase { public function testConstructor() { try { new DateComparator('foobar'); $this->fail('__construct() throws an \InvalidArgumentException if the test expression is not valid.'); } catch (\Exception $e) { $this->assertInstanceOf('InvalidArgumentException', $e, '__construct() throws an \InvalidArgumentException if the test expression is not valid.'); } try { new DateComparator(''); $this->fail('__construct() throws an \InvalidArgumentException if the test expression is not valid.'); } catch (\Exception $e) { $this->assertInstanceOf('InvalidArgumentException', $e, '__construct() throws an \InvalidArgumentException if the test expression is not valid.'); } } /** * @dataProvider getTestData */ public function testTest($test, $match, $noMatch) { $c = new DateComparator($test); foreach ($match as $m) { $this->assertTrue($c->test($m), '->test() tests a string against the expression'); } foreach ($noMatch as $m) { $this->assertFalse($c->test($m), '->test() tests a string against the expression'); } } public function getTestData() { return array( array('< 2005-10-10', array(strtotime('2005-10-09')), array(strtotime('2005-10-15'))), array('until 2005-10-10', array(strtotime('2005-10-09')), array(strtotime('2005-10-15'))), array('before 2005-10-10', array(strtotime('2005-10-09')), array(strtotime('2005-10-15'))), array('> 2005-10-10', array(strtotime('2005-10-15')), array(strtotime('2005-10-09'))), array('after 2005-10-10', array(strtotime('2005-10-15')), array(strtotime('2005-10-09'))), array('since 2005-10-10', array(strtotime('2005-10-15')), array(strtotime('2005-10-09'))), array('!= 2005-10-10', array(strtotime('2005-10-11')), array(strtotime('2005-10-10'))), ); } } __halt_compiler();----SIGNATURE:----a0gsZZt6wIOvfCz798NIdu+RmPfPCVbg5O9ZUJoduHfPz8F1YYB2mnnpm+TqhtzSZqgg09x4KmoXfD/xwk81e+X9Rnj3QKwtUu/88Bff5LKR/vlQxq9R5hKF6xoxfuaidZFLsbmohLIuDWecIB2MZp4AHTB7e7AFepgt/ppgoMFgdDKz4E7ir72b8EpNh9deu5i6RZTq/04RaR8nw81XcycBku6mCLZuij2qoH0Y+34XVoqdzuqanpd6qNhrj10o4EenBMAJk0Na1SMsyklN9XgPJSI2V3i7mNxAlSF75A+YFebORYLev+Gs2hrjiRnteKa9efbpb2Z9YZmntgTcfhCqrlzNtDyg2/GpwmyDPhV61thEBDyThHvYqZ0Y2GQMAIvOfIjwovtfq5dhn0HW0ge3bn6+330ljzEvEms8IKWu3jDP8tvvK2S2uuDZxJNk6moKsfrZDi9SijmAXetGumILUHozRaDuok191CUWm3ctUJbZ7Aq0o0hLHBJgbEDlQ31nUgeE1Gofr84CG8TWxR6WIJRfrVUhmsrpeG1cUbL4FaNUZmVNyhmuAqiSXBkVdjfoVM2D5N9gt1ahMhNcAlxmSqwraF/pCTgEkPwNyV7C9jyE4SdW/OexhvJmlN0vaNN/j5BSLvUh8VrBZU832j8K5lRs2WNAoSm/xzXn5R4=----ATTACHMENT:----NTEwNDA1MDE1Mzg3MDk4IDg4Nzg3MjQ0MDY1ODQ4NjUgNDA2OTMxMTQ0NTMwMDYzMg==