Skip to content

Commit

Permalink
test: add tests for locale info proposal methods
Browse files Browse the repository at this point in the history
  • Loading branch information
ramsey committed Aug 12, 2023
1 parent fb86a6d commit 20c86c9
Show file tree
Hide file tree
Showing 10 changed files with 355 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/intl402/Locale/prototype/collations/name.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

declare(strict_types=1);

use Ecma\Intl\Locale;

$reflected = new ReflectionClass(Locale::class);

it('has a property named "collations"')
->expect($reflected->hasProperty('collations'))
->toBeTrue();

it('has a method named "getCollations"')
->expect($reflected->hasMethod('getCollations'))
->toBeTrue();
56 changes: 56 additions & 0 deletions tests/intl402/Locale/prototype/collations/prop-desc.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php

declare(strict_types=1);

use Ecma\Intl\Locale;

$reflected = new ReflectionClass(Locale::class);
$property = $reflected->getProperty('collations');
$type = $property->getType();

test('its name is "collations"')
->expect($property->getName())
->toBe('collations');

it('is a public property')
->expect($property->isPublic())
->toBeTrue();

it('is not a static property')
->expect($property->isStatic())
->toBeFalse();

it('is a readonly property')
->expect($property->isReadOnly())
->toBeTrue();

it('is an array type and does not allow null values')
->expect($type)
->toBeInstanceOf(ReflectionType::class)
->and($type->allowsNull())
->toBeFalse()
->and($type->getName())
->toBe('array');

$method = $reflected->getMethod('getCollations');
$returnType = $method->getReturnType();

test('its name is "getCollations"')
->expect($method->getName())
->toBe('getCollations');

it('is a public method')
->expect($method->isPublic())
->toBeTrue();

it('is not a static method')
->expect($method->isStatic())
->toBeFalse();

it('returns an array type and does not return null')
->expect($returnType)
->toBeInstanceOf(ReflectionType::class)
->and($returnType->allowsNull())
->toBeFalse()
->and($returnType->getName())
->toBe('array');
15 changes: 15 additions & 0 deletions tests/intl402/Locale/prototype/currencies/name.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

declare(strict_types=1);

use Ecma\Intl\Locale;

$reflected = new ReflectionClass(Locale::class);

it('has a property named "currencies"')
->expect($reflected->hasProperty('currencies'))
->toBeTrue();

it('has a method named "getCurrencies"')
->expect($reflected->hasMethod('getCurrencies'))
->toBeTrue();
56 changes: 56 additions & 0 deletions tests/intl402/Locale/prototype/currencies/prop-desc.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php

declare(strict_types=1);

use Ecma\Intl\Locale;

$reflected = new ReflectionClass(Locale::class);
$property = $reflected->getProperty('currencies');
$type = $property->getType();

test('its name is "currencies"')
->expect($property->getName())
->toBe('currencies');

it('is a public property')
->expect($property->isPublic())
->toBeTrue();

it('is not a static property')
->expect($property->isStatic())
->toBeFalse();

it('is a readonly property')
->expect($property->isReadOnly())
->toBeTrue();

it('is an array type and does not allow null values')
->expect($type)
->toBeInstanceOf(ReflectionType::class)
->and($type->allowsNull())
->toBeFalse()
->and($type->getName())
->toBe('array');

$method = $reflected->getMethod('getCurrencies');
$returnType = $method->getReturnType();

test('its name is "getCurrencies"')
->expect($method->getName())
->toBe('getCurrencies');

it('is a public method')
->expect($method->isPublic())
->toBeTrue();

it('is not a static method')
->expect($method->isStatic())
->toBeFalse();

it('returns an array type and does not return null')
->expect($returnType)
->toBeInstanceOf(ReflectionType::class)
->and($returnType->allowsNull())
->toBeFalse()
->and($returnType->getName())
->toBe('array');
15 changes: 15 additions & 0 deletions tests/intl402/Locale/prototype/hourCycles/name.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

declare(strict_types=1);

use Ecma\Intl\Locale;

$reflected = new ReflectionClass(Locale::class);

it('has a property named "hourCycles"')
->expect($reflected->hasProperty('hourCycles'))
->toBeTrue();

it('has a method named "getHourCycles"')
->expect($reflected->hasMethod('getHourCycles'))
->toBeTrue();
56 changes: 56 additions & 0 deletions tests/intl402/Locale/prototype/hourCycles/prop-desc.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php

declare(strict_types=1);

use Ecma\Intl\Locale;

$reflected = new ReflectionClass(Locale::class);
$property = $reflected->getProperty('hourCycles');
$type = $property->getType();

test('its name is "hourCycles"')
->expect($property->getName())
->toBe('hourCycles');

it('is a public property')
->expect($property->isPublic())
->toBeTrue();

it('is not a static property')
->expect($property->isStatic())
->toBeFalse();

it('is a readonly property')
->expect($property->isReadOnly())
->toBeTrue();

it('is an array type and does not allow null values')
->expect($type)
->toBeInstanceOf(ReflectionType::class)
->and($type->allowsNull())
->toBeFalse()
->and($type->getName())
->toBe('array');

$method = $reflected->getMethod('getHourCycles');
$returnType = $method->getReturnType();

test('its name is "getHourCycles"')
->expect($method->getName())
->toBe('getHourCycles');

it('is a public method')
->expect($method->isPublic())
->toBeTrue();

it('is not a static method')
->expect($method->isStatic())
->toBeFalse();

it('returns an array type and does not return null')
->expect($returnType)
->toBeInstanceOf(ReflectionType::class)
->and($returnType->allowsNull())
->toBeFalse()
->and($returnType->getName())
->toBe('array');
15 changes: 15 additions & 0 deletions tests/intl402/Locale/prototype/numberingSystems/name.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

declare(strict_types=1);

use Ecma\Intl\Locale;

$reflected = new ReflectionClass(Locale::class);

it('has a property named "numberingSystems"')
->expect($reflected->hasProperty('numberingSystems'))
->toBeTrue();

it('has a method named "getNumberingSystems"')
->expect($reflected->hasMethod('getNumberingSystems'))
->toBeTrue();
56 changes: 56 additions & 0 deletions tests/intl402/Locale/prototype/numberingSystems/prop-desc.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php

declare(strict_types=1);

use Ecma\Intl\Locale;

$reflected = new ReflectionClass(Locale::class);
$property = $reflected->getProperty('numberingSystems');
$type = $property->getType();

test('its name is "numberingSystems"')
->expect($property->getName())
->toBe('numberingSystems');

it('is a public property')
->expect($property->isPublic())
->toBeTrue();

it('is not a static property')
->expect($property->isStatic())
->toBeFalse();

it('is a readonly property')
->expect($property->isReadOnly())
->toBeTrue();

it('is an array type and does not allow null values')
->expect($type)
->toBeInstanceOf(ReflectionType::class)
->and($type->allowsNull())
->toBeFalse()
->and($type->getName())
->toBe('array');

$method = $reflected->getMethod('getNumberingSystems');
$returnType = $method->getReturnType();

test('its name is "getNumberingSystems"')
->expect($method->getName())
->toBe('getNumberingSystems');

it('is a public method')
->expect($method->isPublic())
->toBeTrue();

it('is not a static method')
->expect($method->isStatic())
->toBeFalse();

it('returns an array type and does not return null')
->expect($returnType)
->toBeInstanceOf(ReflectionType::class)
->and($returnType->allowsNull())
->toBeFalse()
->and($returnType->getName())
->toBe('array');
15 changes: 15 additions & 0 deletions tests/intl402/Locale/prototype/timeZones/name.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

declare(strict_types=1);

use Ecma\Intl\Locale;

$reflected = new ReflectionClass(Locale::class);

it('has a property named "timeZones"')
->expect($reflected->hasProperty('timeZones'))
->toBeTrue();

it('has a method named "getTimeZones"')
->expect($reflected->hasMethod('getTimeZones'))
->toBeTrue();
56 changes: 56 additions & 0 deletions tests/intl402/Locale/prototype/timeZones/prop-desc.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php

declare(strict_types=1);

use Ecma\Intl\Locale;

$reflected = new ReflectionClass(Locale::class);
$property = $reflected->getProperty('timeZones');
$type = $property->getType();

test('its name is "timeZones"')
->expect($property->getName())
->toBe('timeZones');

it('is a public property')
->expect($property->isPublic())
->toBeTrue();

it('is not a static property')
->expect($property->isStatic())
->toBeFalse();

it('is a readonly property')
->expect($property->isReadOnly())
->toBeTrue();

it('is an array type and allows null values')
->expect($type)
->toBeInstanceOf(ReflectionType::class)
->and($type->allowsNull())
->toBeTrue()
->and($type->getName())
->toBe('array');

$method = $reflected->getMethod('getTimeZones');
$returnType = $method->getReturnType();

test('its name is "getTimeZones"')
->expect($method->getName())
->toBe('getTimeZones');

it('is a public method')
->expect($method->isPublic())
->toBeTrue();

it('is not a static method')
->expect($method->isStatic())
->toBeFalse();

it('returns an array type and can return null')
->expect($returnType)
->toBeInstanceOf(ReflectionType::class)
->and($returnType->allowsNull())
->toBeTrue()
->and($returnType->getName())
->toBe('array');

0 comments on commit 20c86c9

Please sign in to comment.