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
stelgenhof committed Jan 11, 2019
1 parent 7122ac5 commit f56f129
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -15,6 +15,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
4 changes: 2 additions & 2 deletions src/Yasumi/Yasumi.php
Expand Up @@ -233,8 +233,8 @@ public static function getProviders()
$class = new ReflectionClass(sprintf('Yasumi\Provider\%s', str_replace('/', '\\', $provider)));

$key = 'ID';
if ($class->hasConstant($key)) {
$providers[strtoupper($class->getConstant($key))] = $provider;
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
Expand Up @@ -303,6 +303,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 f56f129

Please sign in to comment.