Skip to content

Commit

Permalink
Make sure that original option keys are preserved.
Browse files Browse the repository at this point in the history
  • Loading branch information
nikolaposa committed Jun 11, 2017
1 parent 7679a8c commit 9a618cb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/Options.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@ final protected static function normalize(array $options) : array
$normalizedOptions = [];

foreach ($options as $key => $value) {
$normalizedOptions[$key] = $value;

$normalizedKey = str_replace(' ', '', ucwords(str_replace(['_', '-'], ' ', $key)));
$normalizedKey[0] = strtolower($normalizedKey[0]);

$normalizedOptions[$normalizedKey] = $value;
}

Expand Down
2 changes: 1 addition & 1 deletion tests/CascaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public function it_creates_object_that_has_an_empty_constructor()
/**
* @test
*/
public function it_normalizes_creation_option_keys_to_match_constructor_parameter_names()
public function it_creates_object_regardless_of_options_casing()
{
$object = $this->cascader->create(SubObjectAsset::class, [
'name' => 'test',
Expand Down

0 comments on commit 9a618cb

Please sign in to comment.