Skip to content

Commit 20c86c9

Browse files
committed
test: add tests for locale info proposal methods
1 parent fb86a6d commit 20c86c9

File tree

10 files changed

+355
-0
lines changed

10 files changed

+355
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use Ecma\Intl\Locale;
6+
7+
$reflected = new ReflectionClass(Locale::class);
8+
9+
it('has a property named "collations"')
10+
->expect($reflected->hasProperty('collations'))
11+
->toBeTrue();
12+
13+
it('has a method named "getCollations"')
14+
->expect($reflected->hasMethod('getCollations'))
15+
->toBeTrue();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use Ecma\Intl\Locale;
6+
7+
$reflected = new ReflectionClass(Locale::class);
8+
$property = $reflected->getProperty('collations');
9+
$type = $property->getType();
10+
11+
test('its name is "collations"')
12+
->expect($property->getName())
13+
->toBe('collations');
14+
15+
it('is a public property')
16+
->expect($property->isPublic())
17+
->toBeTrue();
18+
19+
it('is not a static property')
20+
->expect($property->isStatic())
21+
->toBeFalse();
22+
23+
it('is a readonly property')
24+
->expect($property->isReadOnly())
25+
->toBeTrue();
26+
27+
it('is an array type and does not allow null values')
28+
->expect($type)
29+
->toBeInstanceOf(ReflectionType::class)
30+
->and($type->allowsNull())
31+
->toBeFalse()
32+
->and($type->getName())
33+
->toBe('array');
34+
35+
$method = $reflected->getMethod('getCollations');
36+
$returnType = $method->getReturnType();
37+
38+
test('its name is "getCollations"')
39+
->expect($method->getName())
40+
->toBe('getCollations');
41+
42+
it('is a public method')
43+
->expect($method->isPublic())
44+
->toBeTrue();
45+
46+
it('is not a static method')
47+
->expect($method->isStatic())
48+
->toBeFalse();
49+
50+
it('returns an array type and does not return null')
51+
->expect($returnType)
52+
->toBeInstanceOf(ReflectionType::class)
53+
->and($returnType->allowsNull())
54+
->toBeFalse()
55+
->and($returnType->getName())
56+
->toBe('array');
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use Ecma\Intl\Locale;
6+
7+
$reflected = new ReflectionClass(Locale::class);
8+
9+
it('has a property named "currencies"')
10+
->expect($reflected->hasProperty('currencies'))
11+
->toBeTrue();
12+
13+
it('has a method named "getCurrencies"')
14+
->expect($reflected->hasMethod('getCurrencies'))
15+
->toBeTrue();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use Ecma\Intl\Locale;
6+
7+
$reflected = new ReflectionClass(Locale::class);
8+
$property = $reflected->getProperty('currencies');
9+
$type = $property->getType();
10+
11+
test('its name is "currencies"')
12+
->expect($property->getName())
13+
->toBe('currencies');
14+
15+
it('is a public property')
16+
->expect($property->isPublic())
17+
->toBeTrue();
18+
19+
it('is not a static property')
20+
->expect($property->isStatic())
21+
->toBeFalse();
22+
23+
it('is a readonly property')
24+
->expect($property->isReadOnly())
25+
->toBeTrue();
26+
27+
it('is an array type and does not allow null values')
28+
->expect($type)
29+
->toBeInstanceOf(ReflectionType::class)
30+
->and($type->allowsNull())
31+
->toBeFalse()
32+
->and($type->getName())
33+
->toBe('array');
34+
35+
$method = $reflected->getMethod('getCurrencies');
36+
$returnType = $method->getReturnType();
37+
38+
test('its name is "getCurrencies"')
39+
->expect($method->getName())
40+
->toBe('getCurrencies');
41+
42+
it('is a public method')
43+
->expect($method->isPublic())
44+
->toBeTrue();
45+
46+
it('is not a static method')
47+
->expect($method->isStatic())
48+
->toBeFalse();
49+
50+
it('returns an array type and does not return null')
51+
->expect($returnType)
52+
->toBeInstanceOf(ReflectionType::class)
53+
->and($returnType->allowsNull())
54+
->toBeFalse()
55+
->and($returnType->getName())
56+
->toBe('array');
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use Ecma\Intl\Locale;
6+
7+
$reflected = new ReflectionClass(Locale::class);
8+
9+
it('has a property named "hourCycles"')
10+
->expect($reflected->hasProperty('hourCycles'))
11+
->toBeTrue();
12+
13+
it('has a method named "getHourCycles"')
14+
->expect($reflected->hasMethod('getHourCycles'))
15+
->toBeTrue();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use Ecma\Intl\Locale;
6+
7+
$reflected = new ReflectionClass(Locale::class);
8+
$property = $reflected->getProperty('hourCycles');
9+
$type = $property->getType();
10+
11+
test('its name is "hourCycles"')
12+
->expect($property->getName())
13+
->toBe('hourCycles');
14+
15+
it('is a public property')
16+
->expect($property->isPublic())
17+
->toBeTrue();
18+
19+
it('is not a static property')
20+
->expect($property->isStatic())
21+
->toBeFalse();
22+
23+
it('is a readonly property')
24+
->expect($property->isReadOnly())
25+
->toBeTrue();
26+
27+
it('is an array type and does not allow null values')
28+
->expect($type)
29+
->toBeInstanceOf(ReflectionType::class)
30+
->and($type->allowsNull())
31+
->toBeFalse()
32+
->and($type->getName())
33+
->toBe('array');
34+
35+
$method = $reflected->getMethod('getHourCycles');
36+
$returnType = $method->getReturnType();
37+
38+
test('its name is "getHourCycles"')
39+
->expect($method->getName())
40+
->toBe('getHourCycles');
41+
42+
it('is a public method')
43+
->expect($method->isPublic())
44+
->toBeTrue();
45+
46+
it('is not a static method')
47+
->expect($method->isStatic())
48+
->toBeFalse();
49+
50+
it('returns an array type and does not return null')
51+
->expect($returnType)
52+
->toBeInstanceOf(ReflectionType::class)
53+
->and($returnType->allowsNull())
54+
->toBeFalse()
55+
->and($returnType->getName())
56+
->toBe('array');
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use Ecma\Intl\Locale;
6+
7+
$reflected = new ReflectionClass(Locale::class);
8+
9+
it('has a property named "numberingSystems"')
10+
->expect($reflected->hasProperty('numberingSystems'))
11+
->toBeTrue();
12+
13+
it('has a method named "getNumberingSystems"')
14+
->expect($reflected->hasMethod('getNumberingSystems'))
15+
->toBeTrue();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use Ecma\Intl\Locale;
6+
7+
$reflected = new ReflectionClass(Locale::class);
8+
$property = $reflected->getProperty('numberingSystems');
9+
$type = $property->getType();
10+
11+
test('its name is "numberingSystems"')
12+
->expect($property->getName())
13+
->toBe('numberingSystems');
14+
15+
it('is a public property')
16+
->expect($property->isPublic())
17+
->toBeTrue();
18+
19+
it('is not a static property')
20+
->expect($property->isStatic())
21+
->toBeFalse();
22+
23+
it('is a readonly property')
24+
->expect($property->isReadOnly())
25+
->toBeTrue();
26+
27+
it('is an array type and does not allow null values')
28+
->expect($type)
29+
->toBeInstanceOf(ReflectionType::class)
30+
->and($type->allowsNull())
31+
->toBeFalse()
32+
->and($type->getName())
33+
->toBe('array');
34+
35+
$method = $reflected->getMethod('getNumberingSystems');
36+
$returnType = $method->getReturnType();
37+
38+
test('its name is "getNumberingSystems"')
39+
->expect($method->getName())
40+
->toBe('getNumberingSystems');
41+
42+
it('is a public method')
43+
->expect($method->isPublic())
44+
->toBeTrue();
45+
46+
it('is not a static method')
47+
->expect($method->isStatic())
48+
->toBeFalse();
49+
50+
it('returns an array type and does not return null')
51+
->expect($returnType)
52+
->toBeInstanceOf(ReflectionType::class)
53+
->and($returnType->allowsNull())
54+
->toBeFalse()
55+
->and($returnType->getName())
56+
->toBe('array');
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use Ecma\Intl\Locale;
6+
7+
$reflected = new ReflectionClass(Locale::class);
8+
9+
it('has a property named "timeZones"')
10+
->expect($reflected->hasProperty('timeZones'))
11+
->toBeTrue();
12+
13+
it('has a method named "getTimeZones"')
14+
->expect($reflected->hasMethod('getTimeZones'))
15+
->toBeTrue();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use Ecma\Intl\Locale;
6+
7+
$reflected = new ReflectionClass(Locale::class);
8+
$property = $reflected->getProperty('timeZones');
9+
$type = $property->getType();
10+
11+
test('its name is "timeZones"')
12+
->expect($property->getName())
13+
->toBe('timeZones');
14+
15+
it('is a public property')
16+
->expect($property->isPublic())
17+
->toBeTrue();
18+
19+
it('is not a static property')
20+
->expect($property->isStatic())
21+
->toBeFalse();
22+
23+
it('is a readonly property')
24+
->expect($property->isReadOnly())
25+
->toBeTrue();
26+
27+
it('is an array type and allows null values')
28+
->expect($type)
29+
->toBeInstanceOf(ReflectionType::class)
30+
->and($type->allowsNull())
31+
->toBeTrue()
32+
->and($type->getName())
33+
->toBe('array');
34+
35+
$method = $reflected->getMethod('getTimeZones');
36+
$returnType = $method->getReturnType();
37+
38+
test('its name is "getTimeZones"')
39+
->expect($method->getName())
40+
->toBe('getTimeZones');
41+
42+
it('is a public method')
43+
->expect($method->isPublic())
44+
->toBeTrue();
45+
46+
it('is not a static method')
47+
->expect($method->isStatic())
48+
->toBeFalse();
49+
50+
it('returns an array type and can return null')
51+
->expect($returnType)
52+
->toBeInstanceOf(ReflectionType::class)
53+
->and($returnType->allowsNull())
54+
->toBeTrue()
55+
->and($returnType->getName())
56+
->toBe('array');

0 commit comments

Comments
 (0)