From f2879b33c0b9e76e72b7132e561fa754cc3a6ae9 Mon Sep 17 00:00:00 2001 From: Morne Alberts Date: Fri, 21 Feb 2025 14:32:48 +0200 Subject: [PATCH] Add makeFooterIcon() wrapper --- src/ChameleonTemplate.php | 5 +++++ src/Components/FooterIcons.php | 2 +- tests/phpunit/Unit/Components/FooterIconsTest.php | 6 ++---- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/ChameleonTemplate.php b/src/ChameleonTemplate.php index cab7c512..4edb9445 100644 --- a/src/ChameleonTemplate.php +++ b/src/ChameleonTemplate.php @@ -157,4 +157,9 @@ public function getFooterIconsWithImage() { return $footericons; } + + public function makeFooterIcon( string|array $icon ): string { + return $this->getSkin()->makeFooterIcon( $icon ); + } + } diff --git a/src/Components/FooterIcons.php b/src/Components/FooterIcons.php index 2d5101bb..7dd677c1 100644 --- a/src/Components/FooterIcons.php +++ b/src/Components/FooterIcons.php @@ -71,7 +71,7 @@ private function getIcons() { foreach ( $footerIcons as $icon ) { $lines[] = $this->indent() . '
' . - $this->getSkinTemplate()->getSkin()->makeFooterIcon( $icon ) . '
'; + $this->getSkinTemplate()->makeFooterIcon( $icon ) . ''; } } diff --git a/tests/phpunit/Unit/Components/FooterIconsTest.php b/tests/phpunit/Unit/Components/FooterIconsTest.php index 6e413605..43a598ed 100644 --- a/tests/phpunit/Unit/Components/FooterIconsTest.php +++ b/tests/phpunit/Unit/Components/FooterIconsTest.php @@ -47,9 +47,7 @@ class FooterIconsTest extends GenericComponentTestCase { public function testGetHtml() { $chameleonTemplate = $this->getChameleonSkinTemplateStub(); - $skin = $chameleonTemplate->getSkin(); - - $skin->expects( $this->exactly( 4 ) ) + $chameleonTemplate->expects( $this->exactly( 4 ) ) ->method( 'makeFooterIcon' ) ->withConsecutive( [ $this->equalTo( 'icon1' ) ], @@ -57,7 +55,7 @@ public function testGetHtml() { [ $this->equalTo( 'icon3' ) ], [ $this->equalTo( 'icon4' ) ] ) - ->willReturn( $this->returnValue( 'SomeHTML' ) ); + ->willReturn( 'SomeHTML' ); $chameleonTemplate->expects( $this->any() ) ->method( 'getFooterIconsWithImage' )