From 8b7880eda2e84472a34975d31287f8e0d10eb613 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20St=C3=B6hr?= Date: Thu, 26 Oct 2023 15:32:43 +0200 Subject: [PATCH] [MAINTENANCE] Add test for IiifUrlReader (#909) --- Tests/Fixtures/Common/correct.txt | 1 + Tests/Functional/Common/IiifUrlReaderTest.php | 34 +++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 Tests/Fixtures/Common/correct.txt create mode 100644 Tests/Functional/Common/IiifUrlReaderTest.php diff --git a/Tests/Fixtures/Common/correct.txt b/Tests/Fixtures/Common/correct.txt new file mode 100644 index 000000000..e8795d19b --- /dev/null +++ b/Tests/Fixtures/Common/correct.txt @@ -0,0 +1 @@ +Correct result diff --git a/Tests/Functional/Common/IiifUrlReaderTest.php b/Tests/Functional/Common/IiifUrlReaderTest.php new file mode 100644 index 000000000..f9f0ab1b6 --- /dev/null +++ b/Tests/Functional/Common/IiifUrlReaderTest.php @@ -0,0 +1,34 @@ + + * + * This file is part of the Kitodo and TYPO3 projects. + * + * @license GNU General Public License version 3 or later. + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + */ + +namespace Kitodo\Dlf\Tests\Functional\Common; + +use Kitodo\Dlf\Common\IiifUrlReader; +use Kitodo\Dlf\Tests\Functional\FunctionalTestCase; + +class IiifUrlReaderTest extends FunctionalTestCase +{ + /** + * @test + * @group getContent + */ + public function getContentCheck() + { + $iiifUrlReader = new IiifUrlReader(); + + $correctUrl = 'http://web:8001/Tests/Fixtures/Common/correct.txt'; + $expected = "Correct result\n"; + $this->assertSame($expected, $iiifUrlReader->getContent($correctUrl)); + + $incorrectUrl = 'http://web:8001/incorrectPath'; + $this->assertSame('', $iiifUrlReader->getContent($incorrectUrl)); + } +}