From 18ace9b1591d65858a7a4ed0caee58c8afe92f9d 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 1/2] 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 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..ccc52320a --- /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)); + } +} From a49078d592451c3561878cd1d33a47e9b0c73d7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20St=C3=B6hr?= Date: Thu, 26 Oct 2023 14:58:47 +0200 Subject: [PATCH 2/2] Fix code style --- Tests/Functional/Common/IiifUrlReaderTest.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Tests/Functional/Common/IiifUrlReaderTest.php b/Tests/Functional/Common/IiifUrlReaderTest.php index ccc52320a..f9f0ab1b6 100644 --- a/Tests/Functional/Common/IiifUrlReaderTest.php +++ b/Tests/Functional/Common/IiifUrlReaderTest.php @@ -20,7 +20,8 @@ class IiifUrlReaderTest extends FunctionalTestCase * @test * @group getContent */ - public function getContentCheck() { + public function getContentCheck() + { $iiifUrlReader = new IiifUrlReader(); $correctUrl = 'http://web:8001/Tests/Fixtures/Common/correct.txt';