From 736e67bd225ecd0fcb8279e13b3157c03db2f97f Mon Sep 17 00:00:00 2001 From: Demian Katz Date: Wed, 22 May 2024 13:07:59 -0400 Subject: [PATCH] Add test. --- .../VuFindTest/Content/TOC/ObalkyKnihTest.php | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 module/VuFind/tests/unit-tests/src/VuFindTest/Content/TOC/ObalkyKnihTest.php diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/Content/TOC/ObalkyKnihTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/Content/TOC/ObalkyKnihTest.php new file mode 100644 index 00000000000..b5ce54524b7 --- /dev/null +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/Content/TOC/ObalkyKnihTest.php @@ -0,0 +1,63 @@ + + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link https://vufind.org/wiki/development:testing:unit_tests Wiki + */ + +namespace VuFindTest\Content\TOC; + +use VuFind\Content\TOC\ObalkyKnih; + +/** + * ObalkyKnih table of contents handler test. + * + * @category VuFind + * @package Tests + * @author Demian Katz + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link https://vufind.org/wiki/development:testing:unit_tests Wiki + */ +class ObalkyKnihTest extends \PHPUnit\Framework\TestCase +{ + /** + * Test normal operation. + * + * @return void + */ + public function testLoadByIsbn(): void + { + $key = 'fake_key'; + $isbn = new \VuFindCode\ISBN('0123456789'); + $service = $this->createMock(\VuFind\Content\ObalkyKnihService::class); + $data = (object)['toc_thumbnail_url' => 'http://foo/thumb', 'toc_pdf_url' => 'http://foo/pdf']; + $service->expects($this->once())->method('getData')->with(compact('isbn'))->willReturn($data); + $toc = new ObalkyKnih($service); + $this->assertEquals( + '

', + $toc->loadByIsbn($key, $isbn) + ); + } +}