createForReferenceKeyMismatch() 공개 정적인 메소드

public static createForReferenceKeyMismatch ( string $id1, string $id2 ) : InvalidArgumentException
$id1 string
$id2 string
리턴 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());
 }
예제 #2
0
파일: ObjectBag.php 프로젝트: nelmio/alice
 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;
     }
 }