/** * @expectedException \RuntimeException */ public function testGetCallThrowsExceptionAndStillTriggersProfiler() { $this->profiler->expects($this->once())->method('start')->will($this->returnValue(new Benchmark('test'))); $this->profiler->expects($this->once())->method('stop')->will($this->returnValue(new Benchmark('test'))); $this->container->expects($this->once())->method('get')->will($this->throwException(new \RuntimeException())); $instance = $this->adapter->get('sample-id'); }
/** * @test */ public function returnsNullIfIdIsNull() { $id = null; $obj = new \stdClass(); $this->container->expects($this->once())->method('has')->with($id)->will($this->returnValue(true)); $this->container->expects($this->once())->method('get')->with($id)->will($this->returnValue($obj)); $resolved = $this->resolver->resolve($id); $this->assertSame($obj, $resolved); }
public function testFalseWhenContainerDoNotHaveService() { $serviceId = 'some-non-existing-service-id'; $this->container->expects($this->once())->method('has')->with($serviceId)->will($this->returnValue(false)); $this->assertFalse($this->component->has($serviceId)); }