From f7384b5751fe492083da2b9403e35530e04b6a5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20Sto=CC=88hr?= Date: Wed, 8 Feb 2023 13:52:04 +0100 Subject: [PATCH] Add test for IiifUrlReader --- Tests/Fixtures/Common/correct.txt | 1 + Tests/Functional/Common/IiifUrlReaderTest.php | 33 +++++++++++++++++++ 2 files changed, 34 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 0000000000..e8795d19b2 --- /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 0000000000..ccc52320a2 --- /dev/null +++ b/Tests/Functional/Common/IiifUrlReaderTest.php @@ -0,0 +1,33 @@ + + * + * 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)); + } +}