Feb 2, 2015
0
Level 14
PHPSpec Package Developpment
Hi everyone,
I want to develop my new package with a TDD approach. So I install PHPSpec and begin to write my first test.
I need to test an Eloquent Model, the problem is with relation.
function it_should_return_true_if_it_have_children()
{
$comments = new Collection();
$comments->put(new Comment);
$this->children()->willReturn($comments);
$this->shouldHaveChildren();
}
My Stubs didn't work as expected, with that code, I get an exception because I call the method connection on a null. How can I handle that?
Thanks for your help.
Please or to participate in this conversation.