/** * @expectedException \Mcustiel\Conversion\Exception\ObjectIsNotConverterException * @expectedExceptionMessage Object of type stdClass does not implement Mcustiel\Conversion\Converter */ public function testShouldFailWhenImplementationIsNotConverter() { $builder = ConverterBuilder::get()->from(A::class)->to(B::class)->withImplementation(\stdClass::class); ConverterContainer::getInstance()->addConverter($builder); ConverterContainer::getInstance()->getConverter(A::class, B::class); }
public function __construct(ConverterContainer $container = null) { $this->container = $container === null ? ConverterContainer::getInstance() : $container; }
/** * @expectedException \Mcustiel\Conversion\Exception\ObjectIsNotConverterException * @expectedExceptionMessage Object of type stdClass does not implement Mcustiel\Conversion\Converter */ public function testShouldThrowAnExceptionWhenImplementationIsNotConverter() { $this->conversionService = ConverterContainer::getInstance(); $builder = ConverterBuilder::get()->from(B::class)->to(A::class)->withImplementation(\stdClass::class); $this->conversionService->addConverter($builder); $converter = $this->conversionService->getConverter(B::class, A::class); }