Skip to content

Commit

Permalink
Merge pull request #166 from m-safwan/fix_fetch_incorrect_keys
Browse files Browse the repository at this point in the history
  • Loading branch information
bweston92 authored Oct 26, 2022
2 parents 679bba8 + bd11529 commit e154dbb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/SettingStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ public function load($force = false)
if (!$this->loaded || $force) {
$this->data = $this->readData();
$this->persistedData = $this->data;
$this->data = array_merge($this->updatedData, $this->data);
$this->data = $this->updatedData + $this->data;
$this->loaded = true;
}
}
Expand Down
11 changes: 11 additions & 0 deletions tests/functional/AbstractFunctionalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,15 @@ public function defaults_are_respected()
$this->assertStoreEquals($store, ['foo' => 'bar']);
$this->assertStoreKeyEquals($store, ['foo', 'bar'], ['foo' => 'bar', 'bar' => 'default']);
}

/** @test */
public function numeric_keys_are_retrieved_correctly()
{
$store = $this->getStore();
$store->set('1234', 'foo');
$store->set('9876', 'bar');
$store->load(true);
$this->assertStoreEquals($store, ['1234' => 'foo', '9876' => 'bar']);
$this->assertStoreKeyEquals($store, ['1234', '9876'], ['1234' => 'foo', '9876' => 'bar']);
}
}

0 comments on commit e154dbb

Please sign in to comment.