@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | /** |
| 16 | 16 | * An empty parser extension as ground to start from |
| 17 | 17 | */ |
| 18 | -class ParserExtension implements ParserExtensionInterface{ |
|
| 18 | +class ParserExtension implements ParserExtensionInterface { |
|
| 19 | 19 | |
| 20 | 20 | /** |
| 21 | 21 | * @var \chillerlan\bbcode\ParserOptions |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | * |
| 28 | 28 | * @param \chillerlan\bbcode\ParserOptions $options |
| 29 | 29 | */ |
| 30 | - public function __construct(ParserOptions $options){ |
|
| 30 | + public function __construct(ParserOptions $options) { |
|
| 31 | 31 | $this->options = $options; |
| 32 | 32 | } |
| 33 | 33 | |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | * |
| 42 | 42 | * @return string preparsed bbcode |
| 43 | 43 | */ |
| 44 | - public function pre($bbcode){ |
|
| 44 | + public function pre($bbcode) { |
|
| 45 | 45 | return $bbcode; |
| 46 | 46 | } |
| 47 | 47 | |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | * |
| 63 | 63 | * @return string postparsed bbcode |
| 64 | 64 | */ |
| 65 | - public function post($bbcode){ |
|
| 65 | + public function post($bbcode) { |
|
| 66 | 66 | return $bbcode; |
| 67 | 67 | } |
| 68 | 68 | |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | /** |
| 16 | 16 | * Implements pre-/post-parser methods, for example: parsing Smileys |
| 17 | 17 | */ |
| 18 | -interface ParserExtensionInterface{ |
|
| 18 | +interface ParserExtensionInterface { |
|
| 19 | 19 | |
| 20 | 20 | /** |
| 21 | 21 | * Pre-parser |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | * |
| 21 | 21 | * @see \chillerlan\bbcode\Parser::__construct() |
| 22 | 22 | */ |
| 23 | -class ParserOptions{ |
|
| 23 | +class ParserOptions { |
|
| 24 | 24 | |
| 25 | 25 | /** |
| 26 | 26 | * The language class to use (FQN) |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | /** |
| 18 | 18 | * Trait ClassLoaderTrait |
| 19 | 19 | */ |
| 20 | -trait ClassLoaderTrait{ |
|
| 20 | +trait ClassLoaderTrait { |
|
| 21 | 21 | |
| 22 | 22 | /** |
| 23 | 23 | * A simple class loader |
@@ -32,11 +32,11 @@ discard block |
||
| 32 | 32 | * @return object of type $interface |
| 33 | 33 | * @throws \chillerlan\bbcode\BBCodeException |
| 34 | 34 | */ |
| 35 | - protected function __loadClass($class, $interface, ...$params){ // phpDocumentor stumbles across the ... syntax |
|
| 36 | - if(class_exists($class)){ |
|
| 35 | + protected function __loadClass($class, $interface, ...$params) { // phpDocumentor stumbles across the ... syntax |
|
| 36 | + if (class_exists($class)) { |
|
| 37 | 37 | $reflectionClass = new ReflectionClass($class); |
| 38 | 38 | |
| 39 | - if(!$reflectionClass->implementsInterface($interface)){ |
|
| 39 | + if (!$reflectionClass->implementsInterface($interface)) { |
|
| 40 | 40 | throw new BBCodeException($class.' does not implement '.$interface); |
| 41 | 41 | } |
| 42 | 42 | |
@@ -28,20 +28,20 @@ discard block |
||
| 28 | 28 | * @link https://github.com/travis-ci/travis-ci/issues/5323 |
| 29 | 29 | * @link https://github.com/travis-ci/travis-ci/issues/5332 |
| 30 | 30 | */ |
| 31 | -class HTML5ModuleTestCritical extends \PHPUnit_Framework_TestCase{ |
|
| 31 | +class HTML5ModuleTestCritical extends \PHPUnit_Framework_TestCase { |
|
| 32 | 32 | |
| 33 | 33 | /** |
| 34 | 34 | * @var \chillerlan\bbcode\Parser |
| 35 | 35 | */ |
| 36 | 36 | protected $parser; |
| 37 | 37 | |
| 38 | - protected function setUp(){ |
|
| 38 | + protected function setUp() { |
|
| 39 | 39 | $options = new ParserOptions; |
| 40 | 40 | $options->allow_all = true; |
| 41 | 41 | $this->parser = new Parser($options); |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - public function bbcodeDataProvider(){ |
|
| 44 | + public function bbcodeDataProvider() { |
|
| 45 | 45 | return [ |
| 46 | 46 | // basics |
| 47 | 47 | ['', ''], // empty string test (coverage) |
@@ -65,15 +65,15 @@ discard block |
||
| 65 | 65 | /** |
| 66 | 66 | * @dataProvider bbcodeDataProvider |
| 67 | 67 | */ |
| 68 | - public function testParser($bbcode, $expected){ |
|
| 68 | + public function testParser($bbcode, $expected) { |
|
| 69 | 69 | $this->assertEquals($expected, $this->parser->parse($bbcode)); |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - public function nestingDataProvider(){ |
|
| 72 | + public function nestingDataProvider() { |
|
| 73 | 73 | return [ |
| 74 | - [0, 'bbcode_nesting.txt'], |
|
| 75 | - [1, 'results/html5_nesting_1.txt'], |
|
| 76 | - [10, 'results/html5_nesting_10.txt'], |
|
| 74 | + [0, 'bbcode_nesting.txt'], |
|
| 75 | + [1, 'results/html5_nesting_1.txt'], |
|
| 76 | + [10, 'results/html5_nesting_10.txt'], |
|
| 77 | 77 | [100, 'results/html5_nesting_100.txt'], |
| 78 | 78 | ]; |
| 79 | 79 | } |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | /** |
| 82 | 82 | * @dataProvider nestingDataProvider |
| 83 | 83 | */ |
| 84 | - public function testNesting($limit, $resultfile){ |
|
| 84 | + public function testNesting($limit, $resultfile) { |
|
| 85 | 85 | $options = new ParserOptions; |
| 86 | 86 | $options->allow_all = true; |
| 87 | 87 | $options->nesting_limit = $limit; |
@@ -97,8 +97,8 @@ discard block |
||
| 97 | 97 | $this->assertEquals($expected, $parsed); |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - public function testCodeModule(){ |
|
| 101 | - foreach(array_keys($this->parser->getTagmap(), Code::class) as $lang){ |
|
| 100 | + public function testCodeModule() { |
|
| 101 | + foreach (array_keys($this->parser->getTagmap(), Code::class) as $lang) { |
|
| 102 | 102 | $bbcode = file_get_contents(dirname(__FILE__).'/../../bbcode_samples/bbcode_code_'.$lang.'.txt'); |
| 103 | 103 | $expected = file_get_contents(dirname(__FILE__).'/../../bbcode_samples/results/html5_code_'.$lang.'.txt'); |
| 104 | 104 | $parsed = $this->parser->parse($bbcode); |
@@ -24,8 +24,8 @@ |
||
| 24 | 24 | Chinese::class, |
| 25 | 25 | English::class, |
| 26 | 26 | French::class, |
| 27 | - German::class, |
|
| 28 | - Spanish::class, |
|
| 27 | + German::class, |
|
| 28 | + Spanish::class, |
|
| 29 | 29 | ]; |
| 30 | 30 | |
| 31 | 31 | public function testIterateLanguage(){ |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | use chillerlan\bbcode\Language\Spanish; |
| 19 | 19 | use ReflectionClass; |
| 20 | 20 | |
| 21 | -class LanguageBaseTest extends \PHPUnit_Framework_TestCase{ |
|
| 21 | +class LanguageBaseTest extends \PHPUnit_Framework_TestCase { |
|
| 22 | 22 | |
| 23 | 23 | const LANGUAGES = [ |
| 24 | 24 | Chinese::class, |
@@ -28,12 +28,12 @@ discard block |
||
| 28 | 28 | Spanish::class, |
| 29 | 29 | ]; |
| 30 | 30 | |
| 31 | - public function testIterateLanguage(){ |
|
| 32 | - foreach(self::LANGUAGES as $languageInterface){ |
|
| 31 | + public function testIterateLanguage() { |
|
| 32 | + foreach (self::LANGUAGES as $languageInterface) { |
|
| 33 | 33 | $reflectionClass = new ReflectionClass($languageInterface); |
| 34 | 34 | $lang = $reflectionClass->newInstance(); |
| 35 | 35 | |
| 36 | - foreach($lang as $key => $string){ |
|
| 36 | + foreach ($lang as $key => $string) { |
|
| 37 | 37 | $this->assertEquals($lang->string($key, $languageInterface), $lang->{$key}($languageInterface)); |
| 38 | 38 | } |
| 39 | 39 | } |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | use chillerlan\bbcode\Modules\Text\TextBaseModule; |
| 22 | 22 | use ReflectionClass; |
| 23 | 23 | |
| 24 | -class BaseModuleTest extends \PHPUnit_Framework_TestCase{ |
|
| 24 | +class BaseModuleTest extends \PHPUnit_Framework_TestCase { |
|
| 25 | 25 | |
| 26 | 26 | const BASE_MODULES = [ |
| 27 | 27 | Html5BaseModule::class, |
@@ -52,12 +52,12 @@ discard block |
||
| 52 | 52 | */ |
| 53 | 53 | protected $module; |
| 54 | 54 | |
| 55 | - protected function setUp(){ |
|
| 55 | + protected function setUp() { |
|
| 56 | 56 | $this->BBTemp = new BBTemp; |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - public function testBaseModules(){ |
|
| 60 | - foreach(self::BASE_MODULES as $base_module){ |
|
| 59 | + public function testBaseModules() { |
|
| 60 | + foreach (self::BASE_MODULES as $base_module) { |
|
| 61 | 61 | $baseModuleReflection = new ReflectionClass($base_module); |
| 62 | 62 | $this->assertEquals(BaseModuleInterface::class, $baseModuleReflection->getInterfaceNames()[0]); |
| 63 | 63 | |
@@ -68,14 +68,14 @@ discard block |
||
| 68 | 68 | |
| 69 | 69 | // mimicking Parser::setOptions() here |
| 70 | 70 | $tagmap = []; |
| 71 | - foreach($moduleInfoReflection->getProperty('modules')->getValue($this->moduleInfo) as $module){ |
|
| 71 | + foreach ($moduleInfoReflection->getProperty('modules')->getValue($this->moduleInfo) as $module) { |
|
| 72 | 72 | $moduleReflection = new ReflectionClass($module); |
| 73 | 73 | $this->assertEquals(ModuleInterface::class, $moduleReflection->getInterfaceNames()[1]); |
| 74 | 74 | |
| 75 | 75 | $this->module = $moduleReflection->newInstanceArgs([$this->BBTemp]); |
| 76 | 76 | $tagmapArray = $moduleReflection->getMethod('getTags')->invoke($this->module); |
| 77 | 77 | |
| 78 | - foreach($tagmapArray->tags as $tag){ |
|
| 78 | + foreach ($tagmapArray->tags as $tag) { |
|
| 79 | 79 | $tagmap[$tag] = $module; |
| 80 | 80 | } |
| 81 | 81 | } |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | /** |
| 22 | 22 | * Class HTML5ModuleTestCritical |
| 23 | 23 | */ |
| 24 | -class HTML5ModuleTest extends \PHPUnit_Framework_TestCase{ |
|
| 24 | +class HTML5ModuleTest extends \PHPUnit_Framework_TestCase { |
|
| 25 | 25 | |
| 26 | 26 | /** |
| 27 | 27 | * @todo TRAVIS REMINDER! |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | */ |
| 34 | 34 | protected $parser; |
| 35 | 35 | |
| 36 | - protected function setUp(){ |
|
| 36 | + protected function setUp() { |
|
| 37 | 37 | (new Dotenv(__DIR__.'/../../', self::DOTENV))->load(); // nasty |
| 38 | 38 | |
| 39 | 39 | $options = new ParserOptions; |
@@ -44,19 +44,19 @@ discard block |
||
| 44 | 44 | $this->parser = new Parser($options); |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - public function testEmptyTags(){ |
|
| 47 | + public function testEmptyTags() { |
|
| 48 | 48 | $singletags = $this->parser->getSingle(); |
| 49 | - $exceptions = ['td','th']; |
|
| 49 | + $exceptions = ['td', 'th']; |
|
| 50 | 50 | |
| 51 | - foreach(array_keys($this->parser->getTagmap()) as $tag){ |
|
| 52 | - if(!in_array($tag, $singletags) && !in_array($tag, $exceptions)){ |
|
| 51 | + foreach (array_keys($this->parser->getTagmap()) as $tag) { |
|
| 52 | + if (!in_array($tag, $singletags) && !in_array($tag, $exceptions)) { |
|
| 53 | 53 | $parsed = $this->parser->parse('['.$tag.'][/'.$tag.']'); |
| 54 | 54 | $this->assertEquals('', $parsed); |
| 55 | 55 | } |
| 56 | 56 | } |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - public function containerDataProvider(){ |
|
| 59 | + public function containerDataProvider() { |
|
| 60 | 60 | return [ |
| 61 | 61 | ['[div]a div[/div]', '<div class="bb-container left">a div</div>'], |
| 62 | 62 | ['[div align=right]an aligned div[/div]', '<div class="bb-container right">an aligned div</div>'], |
@@ -72,12 +72,12 @@ discard block |
||
| 72 | 72 | /** |
| 73 | 73 | * @dataProvider containerDataProvider |
| 74 | 74 | */ |
| 75 | - public function testContainerModule($bbcode, $expected){ |
|
| 75 | + public function testContainerModule($bbcode, $expected) { |
|
| 76 | 76 | $parsed = $this->parser->parse($bbcode); |
| 77 | 77 | $this->assertEquals($expected, $parsed); |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - public function expanderDataProvider(){ |
|
| 80 | + public function expanderDataProvider() { |
|
| 81 | 81 | return [ |
| 82 | 82 | ['[expander]expander[/expander]', '<div data-id="abcdef12" title="Expander" class="expander-header expander">Expander</div><div id="abcdef12" class="expander-body" style="display:block">expander</div>'], |
| 83 | 83 | ['[expander hide=1]expander[/expander]', '<div data-id="abcdef12" title="Expander" class="expander-header expander">Expander</div><div id="abcdef12" class="expander-body" style="display:none">expander</div>'], |
@@ -93,13 +93,13 @@ discard block |
||
| 93 | 93 | /** |
| 94 | 94 | * @dataProvider expanderDataProvider |
| 95 | 95 | */ |
| 96 | - public function testExpanderModule($bbcode, $expected){ |
|
| 96 | + public function testExpanderModule($bbcode, $expected) { |
|
| 97 | 97 | $parsed = $this->parser->parse($bbcode); |
| 98 | 98 | $parsed = preg_replace('/\"([a-f\d]{8})\"/i', '"abcdef12"', $parsed); |
| 99 | 99 | $this->assertEquals($expected, $parsed); |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | - public function linkDataProvider(){ |
|
| 102 | + public function linkDataProvider() { |
|
| 103 | 103 | return [ |
| 104 | 104 | ['[url]https://github.com/chillerlan/bbcode[/url]', '<a href="https://github.com/chillerlan/bbcode" target="_blank" class="blank">https://github.com/chillerlan/bbcode</a>'], |
| 105 | 105 | ['[url=https://github.com/chillerlan/bbcode]chillerlan/bbcode[/url]', '<a href="https://github.com/chillerlan/bbcode" target="_blank" class="blank">chillerlan/bbcode</a>'], |
@@ -110,17 +110,17 @@ discard block |
||
| 110 | 110 | /** |
| 111 | 111 | * @dataProvider linkDataProvider |
| 112 | 112 | */ |
| 113 | - public function testLinkModule($bbcode, $expected){ |
|
| 113 | + public function testLinkModule($bbcode, $expected) { |
|
| 114 | 114 | $parsed = $this->parser->parse($bbcode); |
| 115 | 115 | $this->assertEquals($expected, $parsed); |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | - public function testListModule(){ |
|
| 118 | + public function testListModule() { |
|
| 119 | 119 | $list_inner_bbcode = '[*]blah[*]blubb[*]foo[*]bar'; |
| 120 | 120 | $list_inner_html = '<li>blah</li><li>blubb</li><li>foo</li><li>bar</li>'; |
| 121 | 121 | |
| 122 | - foreach(['0' => 'decimal-leading-zero', '1' => 'decimal', 'a' => 'lower-alpha', |
|
| 123 | - 'A' => 'upper-alpha', 'i' => 'lower-roman', 'I' => 'upper-roman'] as $type => $css){ |
|
| 122 | + foreach (['0' => 'decimal-leading-zero', '1' => 'decimal', 'a' => 'lower-alpha', |
|
| 123 | + 'A' => 'upper-alpha', 'i' => 'lower-roman', 'I' => 'upper-roman'] as $type => $css) { |
|
| 124 | 124 | // type only |
| 125 | 125 | $parsed = $this->parser->parse('[list type='.$type.']'.$list_inner_bbcode.'[/list]'); |
| 126 | 126 | $this->assertEquals('<ol class="bb-list '.$css.'">'.$list_inner_html.'</ol>', $parsed); |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | $this->assertEquals('<ol start="42" reversed="true" title="WAT" class="foobar bb-list '.$css.'">'.$list_inner_html.'</ol>', $parsed); |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | - foreach(['c' => 'circle', 'd' => 'disc', 's' => 'square'] as $type => $css){ |
|
| 138 | + foreach (['c' => 'circle', 'd' => 'disc', 's' => 'square'] as $type => $css) { |
|
| 139 | 139 | $expected = '<ul class="bb-list '.$css.'">'.$list_inner_html.'</ul>'; |
| 140 | 140 | // type only |
| 141 | 141 | $parsed = $this->parser->parse('[list type='.$type.']'.$list_inner_bbcode.'[/list]'); |
@@ -147,22 +147,22 @@ discard block |
||
| 147 | 147 | } |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | - public function testSimpletextModule(){ |
|
| 151 | - foreach(array_keys($this->parser->getTagmap(), Simpletext::class) as $tag){ |
|
| 150 | + public function testSimpletextModule() { |
|
| 151 | + foreach (array_keys($this->parser->getTagmap(), Simpletext::class) as $tag) { |
|
| 152 | 152 | $parsed = $this->parser->parse('['.$tag.' class=foobar]WAT[/'.$tag.']'); |
| 153 | 153 | $this->assertEquals('<'.$tag.' class="foobar">WAT</'.$tag.'>', $parsed); |
| 154 | 154 | } |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | - public function testSingletagModule(){ |
|
| 158 | - foreach(array_keys($this->parser->getTagmap(), Singletags::class) as $tag){ |
|
| 157 | + public function testSingletagModule() { |
|
| 158 | + foreach (array_keys($this->parser->getTagmap(), Singletags::class) as $tag) { |
|
| 159 | 159 | $parsed = $this->parser->parse('['.$tag.']'); |
| 160 | 160 | $expected = $tag === 'clear' ? '<br class="bb-clear both" />' : '<'.$tag.' />'; |
| 161 | 161 | $this->assertEquals($expected, $parsed); |
| 162 | 162 | } |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | - public function styledTextDataProvider(){ |
|
| 165 | + public function styledTextDataProvider() { |
|
| 166 | 166 | return [ |
| 167 | 167 | ['[color=#424242]color[/color]', '<span class="bb-text color" style="color:#424242">color</span>'], |
| 168 | 168 | ['[font=Helvetica]font[/font]', '<span class="bb-text font" style="font-family:Helvetica">font</span>'], |
@@ -178,12 +178,12 @@ discard block |
||
| 178 | 178 | /** |
| 179 | 179 | * @dataProvider styledTextDataProvider |
| 180 | 180 | */ |
| 181 | - public function testStyledTextModule($bbcode, $expected){ |
|
| 181 | + public function testStyledTextModule($bbcode, $expected) { |
|
| 182 | 182 | $parsed = $this->parser->parse($bbcode); |
| 183 | 183 | $this->assertEquals($expected, $parsed); |
| 184 | 184 | } |
| 185 | 185 | |
| 186 | - public function videoURLDataProvider(){ |
|
| 186 | + public function videoURLDataProvider() { |
|
| 187 | 187 | return [ |
| 188 | 188 | ['https://vimeo.com/136964218', '<iframe src="https://player.vimeo.com/video/136964218" allowfullscreen></iframe>'], |
| 189 | 189 | ['https://www.youtube.com/watch?v=6r1-HTiwGiY', '<iframe src="https://www.youtube.com/embed/6r1-HTiwGiY" allowfullscreen></iframe>'], |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | $this->assertEquals('<div class="bb-video">'.$expected.'</div>', $parsed); |
| 204 | 204 | }*/ |
| 205 | 205 | |
| 206 | - public function videoBBCodeDataProvider(){ |
|
| 206 | + public function videoBBCodeDataProvider() { |
|
| 207 | 207 | return [ |
| 208 | 208 | ['[video]http://youtu.be/6r1-HTiwGiY[/video]', '<div class="bb-video"><iframe src="https://www.youtube.com/embed/6r1-HTiwGiY" allowfullscreen></iframe></div>'], |
| 209 | 209 | ['[youtube]http://youtu.be/6r1-HTiwGiY[/youtube]', '<div class="bb-video"><iframe src="https://www.youtube.com/embed/6r1-HTiwGiY" allowfullscreen></iframe></div>'], |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | |
| 226 | 226 | }*/ |
| 227 | 227 | |
| 228 | - public function tableDataProvider(){ |
|
| 228 | + public function tableDataProvider() { |
|
| 229 | 229 | return [ |
| 230 | 230 | ['[table width=300px class=mybbtyble][tr][td]foobar[/td][/tr][/table]', '<table class="mybbtyble bb-table" style="width:300px"><tr><td>foobar</td></tr></table>'], |
| 231 | 231 | # ['[table][/table]', ''], |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | /** |
| 236 | 236 | * @dataProvider tableDataProvider |
| 237 | 237 | */ |
| 238 | - public function testTableModule($bbcode, $expected){ |
|
| 238 | + public function testTableModule($bbcode, $expected) { |
|
| 239 | 239 | $parsed = $this->parser->parse($bbcode); |
| 240 | 240 | $this->assertEquals($expected, $parsed); |
| 241 | 241 | } |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | use chillerlan\bbcode\ParserOptions; |
| 16 | 16 | use ReflectionClass; |
| 17 | 17 | |
| 18 | -class ParserTest extends \PHPUnit_Framework_TestCase{ |
|
| 18 | +class ParserTest extends \PHPUnit_Framework_TestCase { |
|
| 19 | 19 | |
| 20 | 20 | /** |
| 21 | 21 | * @var \chillerlan\bbcode\Parser |
@@ -27,34 +27,34 @@ discard block |
||
| 27 | 27 | */ |
| 28 | 28 | protected $reflectionClass; |
| 29 | 29 | |
| 30 | - protected function setUp(){ |
|
| 30 | + protected function setUp() { |
|
| 31 | 31 | $this->reflectionClass = new ReflectionClass(Parser::class); |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - public function testInstance(){ |
|
| 34 | + public function testInstance() { |
|
| 35 | 35 | $this->parser = $this->reflectionClass->newInstance(); |
| 36 | 36 | $this->assertInstanceOf(Parser::class, $this->parser); |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | - public function testGetAllowed(){ |
|
| 39 | + public function testGetAllowed() { |
|
| 40 | 40 | $options = new ParserOptions; |
| 41 | - $options->allowed_tags = ['noparse','code','img']; |
|
| 41 | + $options->allowed_tags = ['noparse', 'code', 'img']; |
|
| 42 | 42 | |
| 43 | 43 | $method = $this->reflectionClass->getMethod('getAllowed'); |
| 44 | 44 | $this->parser = $this->reflectionClass->newInstanceArgs([$options]); |
| 45 | - $this->assertEquals(['code','img','noparse'], $method->invoke($this->parser)); |
|
| 45 | + $this->assertEquals(['code', 'img', 'noparse'], $method->invoke($this->parser)); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - public function testGetNoparse(){ |
|
| 49 | - $noparse_tags = ['code','css','html','js','json','noparse','nsis','php','pre','sql','xml']; |
|
| 48 | + public function testGetNoparse() { |
|
| 49 | + $noparse_tags = ['code', 'css', 'html', 'js', 'json', 'noparse', 'nsis', 'php', 'pre', 'sql', 'xml']; |
|
| 50 | 50 | |
| 51 | 51 | $method = $this->reflectionClass->getMethod('getNoparse'); |
| 52 | 52 | $this->parser = $this->reflectionClass->newInstance(); |
| 53 | 53 | $this->assertEquals($noparse_tags, $method->invoke($this->parser)); |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - public function testGetSingle(){ |
|
| 57 | - $singletags = ['br','clear','col','hr']; |
|
| 56 | + public function testGetSingle() { |
|
| 57 | + $singletags = ['br', 'clear', 'col', 'hr']; |
|
| 58 | 58 | |
| 59 | 59 | $method = $this->reflectionClass->getMethod('getSingle'); |
| 60 | 60 | $this->parser = $this->reflectionClass->newInstance(); |