protected function addBetweenCriteriaSpec(Collaborator $queryBuilder, Collaborator $expr, Collaborator $func, array $values) { $now = new \DateTime(); $queryBuilder->expr()->shouldBeCalled()->willReturn($expr); $expr->between($this->getPropertyNameSpec(key($values)), ':from', ':to')->shouldBeCalled()->willReturn($func); $queryBuilder->andWhere($func)->shouldBeCalled()->willReturn($queryBuilder); $queryBuilder->setParameter('from', Argument::type('string'))->shouldBeCalled()->willReturn($queryBuilder); $queryBuilder->setParameter('to', $now->format('Y-m-d'))->shouldBeCalled()->willReturn($queryBuilder); return $queryBuilder; }
/** * @param CollaboratorManager $collaborators * @param \ReflectionMethod $beforeMethod */ private function createMissingCollabolators(CollaboratorManager $collaborators, \ReflectionMethod $beforeMethod) { foreach ($beforeMethod->getParameters() as $parameter) { if (!$collaborators->has($parameter->getName())) { $collaborator = new Collaborator($this->prophet->prophesize()); if (null !== ($class = $parameter->getClass())) { $collaborator->beADoubleOf($class->getName()); } $collaborators->set($parameter->getName(), $collaborator); } } }
public function __construct(ObjectProphecy $prophecy, $class) { parent::__construct($prophecy); $this->prophecy = $prophecy; $this->beADoubleOf($class); }