Skip to content
Permalink
Browse files

Version16

Allowing our Locations to have exits.
  • Loading branch information
jenkoian committed Jan 20, 2015
1 parent 83cbbd8 commit 2355c7582e8260d7cb03401bfad48fcc30174fe6
Showing with 33 additions and 1 deletion.
  1. +11 −0 spec/Jenko/House/RoomSpec.php
  2. +22 −1 src/Jenko/House/Location.php
@@ -48,4 +48,15 @@ function it_should_have_information_on_dimensions()

$info['dimensions']->shouldBe('350 x 300');
}

function it_should_have_exits()
{
$exits = [self::named('kitchen'), self::named('living room')];
$this->setExits($exits);

$this->getExits()->shouldEqual($exits);

$info = $this->getInformation();
$info['exits']->shouldEqual($exits);
}
}
@@ -14,6 +14,11 @@ abstract class Location
*/
private $dimensions;

/**
* @var Location[]|array
*/
private $exits;

/**
* @param string $name
*/
@@ -35,7 +40,7 @@ public function getName()
*/
public function getInformation()
{
return ['dimensions' => (string)$this->getDimensions(), 'exits' => ''];
return ['dimensions' => (string)$this->getDimensions(), 'exits' => $this->getExits()];
}

/**
@@ -53,4 +58,20 @@ public function getDimensions()
{
return $this->dimensions;
}

/**
* @param array $exits
*/
public function setExits(array $exits)
{
$this->exits = $exits;
}

/**
* @return array|Location[]
*/
public function getExits()
{
return $this->exits;
}
}

0 comments on commit 2355c75

Please sign in to comment.
You can’t perform that action at this time.