|
| 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'); |
0 commit comments