Skip to content

Commit

Permalink
Skip AbstractProvider when generating provider list (#107)
Browse files Browse the repository at this point in the history
  • Loading branch information
leafnode authored and stelgenhof committed Jun 8, 2018
1 parent 300017f commit 45ff7b2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
- Fixed spelling issues in the Danish translation. [\#96](https://github.com/azuyalabs/yasumi/pull/96)
- Fixed German Easter Sunday and Pentecost Sunday holidays (not nationwide, only in Brandenburg). [\#100](https://github.com/azuyalabs/yasumi/pull/100)
- Fixed BetweenFilter to ignore time part and timezone. [\#101](https://github.com/azuyalabs/yasumi/pull/101)
- Fixed bug in provider list generation related to variable order of files returned by the filesystem [\#107](https://github.com/azuyalabs/yasumi/pull/107)

### Removed

Expand Down
2 changes: 1 addition & 1 deletion src/Yasumi/Yasumi.php
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ public static function getProviders(): array
$class = new ReflectionClass(\sprintf('Yasumi\Provider\%s', \str_replace('/', '\\', $provider)));

$key = 'ID';
if ($class->hasConstant($key)) {
if ($class->isSubclassOf('Yasumi\Provider\AbstractProvider') && $class->hasConstant($key)) {
$providers[\strtoupper($class->getConstant($key))] = $provider;
}
}
Expand Down
2 changes: 2 additions & 0 deletions tests/Base/YasumiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,8 @@ public function testGetProviders()
$this->assertNotEmpty($providers);
$this->assertInternalType('array', $providers);
$this->assertContains('Netherlands', $providers);
$this->assertEquals('USA', $providers['US']);
$this->assertNotContains('AbstractProvider', $providers);
}

/**
Expand Down

0 comments on commit 45ff7b2

Please sign in to comment.