In PhpSpec, everything that is included in the argument let(), letgo()or it_*(), is a test double. It is not intended for use with scalars.
PhpSpec @param. . , \stdClass. Double\stdClass\P14 double. .
:
private $price = 5;
function let(Buyable $buyable)
{
$buyable->getPrice()->willReturn($this->price);
$this->beConstructedWith($buyable, 0);
}
function it_returns_the_same_price_if_discount_is_zero()
{
$this->getDiscountPrice()->shouldReturn($this->price);
}
, :
function let(Buyable $buyable)
{
$this->beConstructedWith($buyable, 0);
}
function it_returns_the_same_price_if_discount_is_zero(Buyable $buyable)
{
$this->beConstructedWith($buyable, 0);
$buyable->getPrice()->willReturn(5);
$this->getDiscountPrice()->shouldReturn(5);
}