mirror of
https://github.com/Universal-Omega/PortableInfobox.git
synced 2024-11-15 11:59:56 +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
|
||||
*
|
||||
* @param $elementData
|
||||
* @param $elementText
|
||||
* @param string $allowedTags
|
||||
* @return string
|
||||
*/
|
||||
private function sanitizeElementData( $elementData, $allowedTags = '' ) {
|
||||
if ( !empty( $elementData ) ) {
|
||||
$strippedElementData = trim( strip_tags( $elementData, $allowedTags ) );
|
||||
private function sanitizeElementData( $elementText, $allowedTags = null ) {
|
||||
if ( !empty( $elementText ) ) {
|
||||
$elementTextAfterTrim = trim( strip_tags( $elementText, $allowedTags ) );
|
||||
|
||||
if ( $strippedElementData !== $elementData ) {
|
||||
\Wikia\Logger\WikiaLogger::instance()->info( 'Striping HTML tags from infobox element' );
|
||||
$elementData = $strippedElementData;
|
||||
if ( $elementTextAfterTrim !== $elementText ) {
|
||||
WikiaLogger::instance()->info( 'Striping HTML tags from infobox element' );
|
||||
$elementText = $elementTextAfterTrim;
|
||||
}
|
||||
}
|
||||
return $elementData;
|
||||
return $elementText;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -41,6 +41,8 @@ class PortableInfoboxRenderService extends WikiaService {
|
|||
*
|
||||
* @param array $infoboxdata
|
||||
*
|
||||
* @param $theme
|
||||
* @param $layout
|
||||
* @return string - infobox HTML
|
||||
*/
|
||||
public function renderInfobox( array $infoboxdata, $theme, $layout ) {
|
||||
|
|
|
@ -65,13 +65,14 @@ class PortableInfoboxRenderServiceTest extends WikiaBaseTest {
|
|||
* @param $input
|
||||
* @param $expectedOutput
|
||||
* @param $description
|
||||
* @param $mockParams
|
||||
* @dataProvider testRenderInfoboxDataProvider
|
||||
*/
|
||||
public function testRenderInfobox( $input, $expectedOutput, $description, $mockParams ) {
|
||||
$this->mockInfoboxRenderServiceHelper( $mockParams );
|
||||
|
||||
$infoboxRenderService = new PortableInfoboxRenderService();
|
||||
$actualOutput = $infoboxRenderService->renderInfobox( $input );
|
||||
$actualOutput = $infoboxRenderService->renderInfobox( $input, null, null );
|
||||
|
||||
$expectedHtml = $this->normalizeHTML( $expectedOutput) ;
|
||||
$actualHtml = $this->normalizeHTML( $actualOutput );
|
||||
|
|
Loading…
Reference in a new issue