| | 1 | <?php |
| | 2 | /** |
| | 3 | * The Tests_Autop_Newline_Preservation_Helper() from Formatter |
| | 4 | * |
| | 5 | * @group formatting |
| | 6 | */ |
| | 7 | class Tests_Autop_Newline_Preservation_Helper extends WP_UnitTestCase { |
| | 8 | |
| | 9 | /** |
| | 10 | * data provider |
| | 11 | * |
| | 12 | * @return array |
| | 13 | */ |
| | 14 | function data_autop_newline_preservation_helper() { |
| | 15 | return array( |
| | 16 | array( PHP_EOL, '<WPPreserveNewline />', ' 1 PHP_EOL' ), |
| | 17 | array( " |
| | 18 | ", '<WPPreserveNewline />', 'passing line return in string' ), |
| | 19 | array( '/n', '/', ' passing /n in string' ), |
| | 20 | array( 'd', 'd', ' just a d ' ), |
| | 21 | array( 'd' . PHP_EOL, 'd', ' just a d ' ), |
| | 22 | ); |
| | 23 | } |
| | 24 | |
| | 25 | /** |
| | 26 | * @dataProvider data_autop_newline_preservation_helper |
| | 27 | * @covers ::_autop_newline_preservation_helper |
| | 28 | * |
| | 29 | * @param $input |
| | 30 | * @param $expected |
| | 31 | * @param $message |
| | 32 | */ |
| | 33 | function test_autop_newline_preservation_helper( $input, $expected, $message ) { |
| | 34 | |
| | 35 | $this->assertSame( $expected, _autop_newline_preservation_helper( $input ), $message ); |
| | 36 | } |
| | 37 | |
| | 38 | |
| | 39 | } |