| 1 | <?php |
||
| 4 | class HelperTest extends \PHPUnit_Framework_TestCase |
||
| 5 | { |
||
| 6 | const EXPRESSION = "Let me test this expression"; |
||
| 7 | const EXPRESSION_PLURAL = "Let me test this plural expression"; |
||
| 8 | |||
| 9 | public function testDoubleUnderscore() |
||
| 10 | { |
||
| 11 | $this->assertTrue(function_exists('__'), "__ function do not exists."); |
||
| 12 | $this->assertEquals(self::EXPRESSION, __(self::EXPRESSION)); |
||
| 13 | } |
||
| 14 | |||
| 15 | public function testUnderscoreE() |
||
| 16 | { |
||
| 17 | $this->assertTrue(function_exists('_e'), "_e function do not exists."); |
||
| 18 | $this->expectOutputRegex('/' . self::EXPRESSION . '/'); |
||
| 19 | _e(self::EXPRESSION); |
||
| 20 | } |
||
| 21 | |||
| 22 | public function testUnderscroreN_Singular() |
||
| 23 | { |
||
| 24 | $this->assertTrue(function_exists('_n'), "_e function do not exists."); |
||
| 25 | $this->assertEquals( |
||
| 26 | self::EXPRESSION, |
||
| 27 | _n(self::EXPRESSION, self::EXPRESSION_PLURAL, 1) |
||
| 28 | ); |
||
| 29 | } |
||
| 30 | |||
| 31 | public function testUnderscroreN_Plural() |
||
| 32 | { |
||
| 33 | $this->assertTrue(function_exists('_n'), "_e function do not exists."); |
||
| 34 | $this->assertEquals( |
||
| 35 | self::EXPRESSION_PLURAL, |
||
| 36 | _n(self::EXPRESSION, self::EXPRESSION_PLURAL, 2) |
||
| 37 | ); |
||
| 38 | } |
||
| 39 | |||
| 40 | } |