Skip to content

Commit

Permalink
MNT Ignore narrow no-break space in regex in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
GuySartorelli committed Jun 25, 2024
1 parent 23c1a0f commit 24af848
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion tests/php/Forms/DatetimeFieldTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public function testSetValueWithLocalised()

// Some localisation packages exclude the ',' in default medium format
$this->assertMatchesRegularExpression(
'#29/03/2003(,)? 11:00:00 (PM|pm)#',
'#29/03/2003(,)?\h11:00:00\h(PM|pm)#u',
$datetimeField->Value(),
'User value is formatted, and in user timezone'
);
Expand Down
6 changes: 3 additions & 3 deletions tests/php/ORM/DBDatetimeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,10 @@ public function testNice()

// note: Some localisation packages exclude the ',' in default medium format
i18n::set_locale('en_NZ');
$this->assertMatchesRegularExpression('#11/12/2001(,)? 10:10 PM#i', $date->Nice());
$this->assertMatchesRegularExpression('#11/12/2001(,)?\h10:10\hPM#iu', $date->Nice());

i18n::set_locale('en_US');
$this->assertMatchesRegularExpression('#Dec 11(,)? 2001(,)? 10:10 PM#i', $date->Nice());
$this->assertMatchesRegularExpression('#Dec\h11(,)?\h2001(,)?\h10:10\hPM#iu', $date->Nice());
}

public function testDate()
Expand All @@ -142,7 +142,7 @@ public function testDate()
public function testTime()
{
$date = DBDatetime::create_field('Datetime', '2001-12-31 22:10:59');
$this->assertMatchesRegularExpression('#10:10:59 PM#i', $date->Time());
$this->assertMatchesRegularExpression('#10:10:59\hPM#iu', $date->Time());
}

public function testTime24()
Expand Down
4 changes: 2 additions & 2 deletions tests/php/ORM/DBTimeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ public function testParse($input, $expected)
public function testNice()
{
$time = DBTime::create_field('Time', '17:15:55');
$this->assertMatchesRegularExpression('#5:15:55 PM#i', $time->Nice());
$this->assertMatchesRegularExpression('#5:15:55\hPM#iu', $time->Nice());
}

public function testShort()
{
$time = DBTime::create_field('Time', '17:15:55');
$this->assertMatchesRegularExpression('#5:15 PM#i', $time->Short());
$this->assertMatchesRegularExpression('#5:15\hPM#iu', $time->Short());
}
}

0 comments on commit 24af848

Please sign in to comment.