Skip to content

Commit

Permalink
clean up for v0.8.2
Browse files Browse the repository at this point in the history
  • Loading branch information
electricjones committed Jun 5, 2015
1 parent 7fefd41 commit 38be36f
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 27 deletions.
2 changes: 1 addition & 1 deletion src/Contracts/ManagesItemsInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ interface ManagesItemsInterface
*
* @param array $items
*/
public function initManager($items);
public function initManager($items = []);

/**
* Adds a single item.
Expand Down
5 changes: 5 additions & 0 deletions src/Traits/ManagesItemsTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@ public function getAll()
return $this->items;
}

/**
* Return all items as array
*
* @return array
*/
public function all()
{
return $this->getAll();
Expand Down
4 changes: 4 additions & 0 deletions tests/Stubs/ChainsNestedItemsTraitStub.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
use Michaels\Manager\Traits\ChainsNestedItemsTrait;
use Michaels\Manager\Traits\ManagesItemsTrait;

/**
* Class ChainsNestedItemsTraitStub
* @package Stubs
*/
class ChainsNestedItemsTraitStub
{
use ManagesItemsTrait, ChainsNestedItemsTrait;
Expand Down
4 changes: 4 additions & 0 deletions tests/Stubs/ManagesItemsTraitStub.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@

use Michaels\Manager\Traits\ManagesItemsTrait;

/**
* Class ManagesItemsTraitStub
* @package Stubs
*/
class ManagesItemsTraitStub
{
use ManagesItemsTrait;
Expand Down
26 changes: 0 additions & 26 deletions tests/Traits/ManagesItemsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,32 +71,6 @@ public function testInitManagerFromManager()
$this->assertEquals(['foo' => 'bar'], $secondManager->getAll());
}

/* ToDo: Figure out how to make nested objects at initialization pass */
/* Use optional flag to flatten objects? */
/*public function testInitManagerWithNestedManagers()
{
$firstManager = new Manager(['five' => 5]);
$secondManager = new Manager(['four' => $firstManager]);
$thirdManager = new Manager(['three' => $secondManager]);
$fourthManager = new Manager(['two' => $thirdManager]);
$topManager = new Manager(['one' => $fourthManager]);
$expected = [
'one' => [
'two' => [
'three' => [
'four' => [
'five' => 5
]
]
]
]
];
$this->assertEquals($expected, $topManager->getAll());
$this->assertEquals(5, $topManager->get("one.two.three.four.five"));
}*/

public function testInitManagerFromObject()
{
$object = new stdClass();
Expand Down

0 comments on commit 38be36f

Please sign in to comment.