Skip to content

Commit

Permalink
Return instance.
Browse files Browse the repository at this point in the history
Signed-off-by: crynobone <[email protected]>
  • Loading branch information
crynobone committed Jan 4, 2014
1 parent a81a64f commit ba2c29a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/Orchestra/Support/Messages.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,14 @@ public function retrieve()
* Extend Messages instance from session.
*
* @param \Closure $callback
* @return void
* @return Messages
*/
public function extend(Closure $callback)
{
$instance = $this->retrieve();
call_user_func($callback, $instance);

return $instance;
}

/**
Expand Down
3 changes: 2 additions & 1 deletion tests/MessagesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,12 @@ public function testExtendMethod()
};

$stub = with(new Messages)->setSession($session);
$stub->extend($callback);
$output = $stub->extend($callback);

$retrieve = $stub->retrieve();
$retrieve->setFormat();

$this->assertInstanceOf('\Orchestra\Support\Messages', $output);
$this->assertInstanceOf('\Orchestra\Support\Messages', $retrieve);
$this->assertEquals(array('Hi World', 'Hi Orchestra Platform'), $retrieve->get('hello'));
}
Expand Down

0 comments on commit ba2c29a

Please sign in to comment.