createForReferenceKeyMismatch() public static method

public static createForReferenceKeyMismatch ( string $id1, string $id2 ) : InvalidArgumentException
$id1 string
$id2 string
return InvalidArgumentException
 public function testTestCreateForReferenceKeyMismatch()
 {
     $exception = InvalidArgumentExceptionFactory::createForReferenceKeyMismatch('foo', 'bar');
     $this->assertEquals('Reference key mismatch, the keys "foo" and "bar" refers to the same fixture but the keys are different.', $exception->getMessage());
     $this->assertEquals(0, $exception->getCode());
     $this->assertNull($exception->getPrevious());
 }
Beispiel #2
0
 public function __construct(array $objects = [])
 {
     foreach ($objects as $id => $object) {
         if ($object instanceof ObjectInterface) {
             if ($id !== $object->getId()) {
                 throw InvalidArgumentExceptionFactory::createForReferenceKeyMismatch($id, $object->getId());
             }
             $this->objects[$id] = $object;
             $this->array[$id] = $object->getInstance();
             continue;
         }
         $this->objects[$id] = new CompleteObject(new SimpleObject($id, $object));
         $this->array[$id] = $object;
     }
 }