We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
| 1 | <?php |
||
| 41 | class Dash_Style_Test extends PHP_Typography_Testcase { |
||
| 42 | |||
| 43 | |||
| 44 | /** |
||
| 45 | * Provide test data for testing get_styled_dashes. |
||
| 46 | */ |
||
| 47 | public function provide_get_styled_dashes_data() { |
||
| 48 | return [ |
||
| 49 | [ Dash_Style::TRADITIONAL_US, [ U::EM_DASH, U::THIN_SPACE, U::EN_DASH, U::THIN_SPACE ] ], |
||
| 50 | [ Dash_Style::INTERNATIONAL, [ U::EN_DASH, ' ', U::EN_DASH, U::HAIR_SPACE ] ], |
||
| 51 | [ 'foo', null ], |
||
| 52 | [ 123, null ], |
||
| 53 | ]; |
||
| 54 | } |
||
| 55 | |||
| 56 | /** |
||
| 57 | * Test get_styled_dashes. |
||
| 58 | * |
||
| 59 | * @covers ::get_styled_dashes |
||
| 60 | * |
||
| 61 | * @dataProvider provide_get_styled_dashes_data |
||
| 62 | * |
||
| 63 | * @param mixed $style Style index. |
||
| 64 | * @param array|null $result Result array (or null). |
||
| 65 | */ |
||
| 66 | public function test_get_styled_dashes( $style, array $result = null ) { |
||
| 67 | $s = $this->createMock( \PHP_Typography\Settings::class ); |
||
| 68 | |||
| 69 | $dashes = Dash_Style::get_styled_dashes( $style, $s ); |
||
| 70 | |||
| 71 | if ( is_array( $result ) ) { |
||
| 72 | $this->assertInstanceOf( Dashes::class, $dashes ); |
||
| 73 | $this->assertSame( $result[0], $dashes->parenthetical_dash() ); |
||
| 74 | $this->assertSame( $result[1], $dashes->parenthetical_space() ); |
||
| 75 | $this->assertSame( $result[2], $dashes->interval_dash() ); |
||
| 76 | $this->assertSame( $result[3], $dashes->interval_space() ); |
||
| 77 | } else { |
||
| 78 | $this->assertNull( $dashes, 'get_styled_dashes should return null for invalid indices.' ); |
||
| 79 | } |
||
| 80 | } |
||
| 81 | } |
||
| 82 |