name = $name; $section->text = $text; $section->setIsInline( $inline ); $output = $section->getMarkedText(); $this->assertEquals( $expected, $output ); } /** * @dataProvider providerTestGetTextWithVariables */ public function testGetTextWithVariables( $text, $expected ) { $section = new TPSection(); $section->text = $text; $output = $section->getTextWithVariables(); $this->assertEquals( $expected, $output ); } /** * @dataProvider providerTestGetTextForTrans */ public function testGetTextForTrans( $text, $expected ) { $section = new TPSection(); $section->text = $text; $output = $section->getTextForTrans(); $this->assertEquals( $expected, $output ); } public static function providerTestGetMarkedText() { $cases = []; // Inline syntax $cases[] = [ 'name', 'Hello', true, ' Hello', ]; // Normal syntax $cases[] = [ 'name', 'Hello', false, "\nHello", ]; // Inline should not matter for headings, which have special syntax, but test both values $cases[] = [ 'name', '== Hello ==', true, '== Hello == ', ]; $cases[] = [ 'name', '====== Hello ======', false, '====== Hello ====== ', ]; return $cases; } public static function providerTestGetTextWithVariables() { $cases = []; // syntax $cases[] = [ "Peter\n cat!", '$abc', ]; $cases[] = [ "Hello\nHello", "$1\n$2", ]; return $cases; } public static function providerTestGetTextForTrans() { $cases = []; // syntax $cases[] = [ "Peter\n cat!", "Peter\n cat!", ]; $cases[] = [ "Hello\nHello", "Hello\nHello", ]; return $cases; } }