/**
  * @param StdClass $rightObject
  * @param StdClass $wrongObject
  * @param Knp\FriendlyContexts\Reflection\ObjectReflector $reflector
  * @param Knp\FriendlyContexts\Record\Collection $collection
  **/
 function let(\StdClass $rightObject, \StdClass $wrongObject, ObjectReflector $reflector, Collection $collection)
 {
     $reflector->getClassName($rightObject)->willReturn('TheClass');
     $reflector->getClassNamespace($rightObject)->willReturn('The\\Name\\Space');
     $reflector->getClassName($wrongObject)->willReturn('TheOtherClass');
     $reflector->getClassNamespace($wrongObject)->willReturn('The\\Other\\Name\\Space');
     $collection->support($rightObject)->willReturn(true);
     $collection->support($wrongObject)->willReturn(false);
     $this->beConstructedWith($reflector, $collection);
 }
Esempio n. 2
0
 public function getCollection($entity)
 {
     foreach ($this->collections as $collection) {
         if ($collection->support($entity)) {
             return $collection;
         }
     }
     $new = new Collection($this->reflector);
     $new->support($entity);
     return $this->collections[] = $new;
 }