mirror of
https://github.com/Universal-Omega/PortableInfobox.git
synced 2024-11-15 20:09:44 +00:00
change variable names and add missing PHPdocs
This commit is contained in:
parent
2214b5c81f
commit
649895d4cf
|
@ -69,20 +69,20 @@ class PortableInfoboxRenderServiceHelper {
|
||||||
/**
|
/**
|
||||||
* process single title or label
|
* process single title or label
|
||||||
*
|
*
|
||||||
* @param $elementData
|
* @param $elementText
|
||||||
* @param string $allowedTags
|
* @param string $allowedTags
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
private function sanitizeElementData( $elementData, $allowedTags = '' ) {
|
private function sanitizeElementData( $elementText, $allowedTags = null ) {
|
||||||
if ( !empty( $elementData ) ) {
|
if ( !empty( $elementText ) ) {
|
||||||
$strippedElementData = trim( strip_tags( $elementData, $allowedTags ) );
|
$elementTextAfterTrim = trim( strip_tags( $elementText, $allowedTags ) );
|
||||||
|
|
||||||
if ( $strippedElementData !== $elementData ) {
|
if ( $elementTextAfterTrim !== $elementText ) {
|
||||||
\Wikia\Logger\WikiaLogger::instance()->info( 'Striping HTML tags from infobox element' );
|
WikiaLogger::instance()->info( 'Striping HTML tags from infobox element' );
|
||||||
$elementData = $strippedElementData;
|
$elementText = $elementTextAfterTrim;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $elementData;
|
return $elementText;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -41,6 +41,8 @@ class PortableInfoboxRenderService extends WikiaService {
|
||||||
*
|
*
|
||||||
* @param array $infoboxdata
|
* @param array $infoboxdata
|
||||||
*
|
*
|
||||||
|
* @param $theme
|
||||||
|
* @param $layout
|
||||||
* @return string - infobox HTML
|
* @return string - infobox HTML
|
||||||
*/
|
*/
|
||||||
public function renderInfobox( array $infoboxdata, $theme, $layout ) {
|
public function renderInfobox( array $infoboxdata, $theme, $layout ) {
|
||||||
|
|
|
@ -65,13 +65,14 @@ class PortableInfoboxRenderServiceTest extends WikiaBaseTest {
|
||||||
* @param $input
|
* @param $input
|
||||||
* @param $expectedOutput
|
* @param $expectedOutput
|
||||||
* @param $description
|
* @param $description
|
||||||
|
* @param $mockParams
|
||||||
* @dataProvider testRenderInfoboxDataProvider
|
* @dataProvider testRenderInfoboxDataProvider
|
||||||
*/
|
*/
|
||||||
public function testRenderInfobox( $input, $expectedOutput, $description, $mockParams ) {
|
public function testRenderInfobox( $input, $expectedOutput, $description, $mockParams ) {
|
||||||
$this->mockInfoboxRenderServiceHelper( $mockParams );
|
$this->mockInfoboxRenderServiceHelper( $mockParams );
|
||||||
|
|
||||||
$infoboxRenderService = new PortableInfoboxRenderService();
|
$infoboxRenderService = new PortableInfoboxRenderService();
|
||||||
$actualOutput = $infoboxRenderService->renderInfobox( $input );
|
$actualOutput = $infoboxRenderService->renderInfobox( $input, null, null );
|
||||||
|
|
||||||
$expectedHtml = $this->normalizeHTML( $expectedOutput) ;
|
$expectedHtml = $this->normalizeHTML( $expectedOutput) ;
|
||||||
$actualHtml = $this->normalizeHTML( $actualOutput );
|
$actualHtml = $this->normalizeHTML( $actualOutput );
|
||||||
|
|
Loading…
Reference in a new issue