public function testLookupWithInvalidResponseEntry()
 {
     $newIdentity = new Identity('foo', ['http://localhost']);
     $this->backend->expects(self::exactly(2))->method('get')->with('foo')->willReturnOnConsecutiveCalls(null, $newIdentity);
     $this->discovery->expects(self::once())->method('call')->with(new Discover())->willReturn(new Promise(function () {
         return new Response([['name' => 'foo', 'urls' => ['http://localhost']], ['invalid']]);
     }));
     $this->backend->expects(self::once())->method('register')->with($newIdentity);
     $identity = $this->registry->get('foo');
     self::assertSame($newIdentity, $identity);
 }
 /**
  * ArrayDiscovery should throw an exception for undefined service.
  */
 public function testDiscoveryException()
 {
     $this->registry->expects(self::once())->method('get')->with('bar')->willReturn(null);
     $this->expectException(ServiceNotFoundException::class);
     $this->discovery->discover('bar');
 }