Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
g105b committed May 31, 2018
1 parent c4929dc commit a270fbb
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ protected function getSectionValue(string $name):?string {
return null;
}

return $section->get($parts[1]);
return $section[$parts[1]];
}

protected function loadIni(string $directoryPath, string $filename):array {
Expand Down
4 changes: 2 additions & 2 deletions src/ConfigSection.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public function __construct(array $data) {
$this->data = $data;
}

public function get(string $key):?array {
public function get(string $key):?string {
return $this->data[$key] ?? null;
}

Expand Down Expand Up @@ -63,7 +63,7 @@ public function offsetExists($offset):bool {
/**
* @link http://php.net/manual/en/arrayaccess.offsetget.php
*/
public function offsetGet($offset):?array {
public function offsetGet($offset):?string {
return $this->get($offset);
}

Expand Down
4 changes: 2 additions & 2 deletions test/unit/ConfigSectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ public function testOffsetNotExists():void {
}

public function testOffsetGet():void {
$section = new ConfigSection(self::DATA);
$section = new ConfigSection(self::DATA["app"]);

foreach(self::DATA as $key => $value) {
foreach(self::DATA["app"] as $key => $value) {
self::assertArrayHasKey($key, $section);
self::assertEquals($value, $section[$key]);
}
Expand Down

0 comments on commit a270fbb

Please sign in to comment.