When testing with PHPSpec how can I use class interfaces injected into my methods rather then the actual concrete class?
For example I have a Product
class that injects a VariationInterface
into a method:
/**
* ...
*/
public function addVarient(VarientInterface $varient)
{
return $this->varients->add($varient);
}
Although since PHPSpec has no IOC container to bind VarientInterface
to Varient
I cant really test my classes.
Is it not best practice to code to an interface and not a concrete class?