/** * @test * @expectedException RuntimeException * @expectedExceptionMessage Found service class mismatch with expected type! - name: 'SingletonTestService' type: 'PhSpring\Annotations\Autowired' */ public function withQualifierAndWrongType() { Collection::add('SingletonTestService', Singleton::getInstance()); $instance = new ClassInvokerFixture(); $refl = new ReflectionProperty(ClassInvokerFixture::class, 'singleton5'); $this->handler->run($refl, $instance); }
/** * @covers PhSpring\Annotation\Collection::run * @test */ public function runWithAnnotations() { $this->setEnv(array(new Autowired(array()))); $this->assertTrue($this->property->getValue($this->fixture) === null); $this->collection->run($this->fixture); $val = $this->property->getValue($this->fixture); $this->assertTrue($val === Singleton::getInstance()); }