Skip to content
This repository was archived by the owner on Dec 11, 2020. It is now read-only.

Commit ac6690f

Browse files
committed
Adjust test so it runs in older PHP versions
1 parent 1ffc81d commit ac6690f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

test/Faker/Provider/nb_NO/PhoneNumberTest.php

+5-3
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,17 @@ public function testMobileNumber()
2323
$number = $this->faker->mobileNumber;
2424

2525
// Check that number starts with 4 or 9 when country code is included
26-
if ($number[0] === '+') {
26+
if (strlen($number) === 11) {
27+
$testChar = substr($number, 3, 1);
2728
$this->assertEquals(11, strlen($number));
28-
$this->assertContains($number[3], [4, 9]);
29+
$this->assertContains($testChar, array(4, 9));
2930
$this->assertRegExp('/^\+47[49]{1}[0-9]{7}$/', $number);
3031
}
3132

3233
// Check numbers start with 4 or 9 when no country code is included
3334
if (strlen($number) === 10 || strlen($number) === 8) {
34-
$this->assertContains($number[0], [4, 9]);
35+
$testChar = substr($number, 0, 1);
36+
$this->assertContains($testChar, array(4, 9));
3537
}
3638

3739
if (strlen($number) === 10) {

0 commit comments

Comments
 (0)