Skip to content

Instantly share code, notes, and snippets.

@coreymcmahon
Created July 12, 2014 08:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coreymcmahon/9393387be554395e13fe to your computer and use it in GitHub Desktop.
Save coreymcmahon/9393387be554395e13fe to your computer and use it in GitHub Desktop.
Mocking the Filesystem during BDD with Behat and PHPSpec - www.slashnode.com
<?php
namespace spec;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
class ConfigSpec extends ObjectBehavior
{
function it_is_initializable()
{
$this->shouldHaveType('Config');
}
function it_gets_and_sets_an_option()
{
$this->get('foo')->shouldReturn(null);
$this->set('foo', 'bar');
$this->get('foo')->shouldReturn('bar');
}
function it_gets_a_default_value_when_option_is_not_set()
{
$this->get('foo')->shouldReturn(null);
$this->get('foo', 'bar')->shouldReturn('bar');
$this->set('foo', 'not bar');
$this->get('foo', 'bar')->shouldReturn('not bar');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment