/** @test */ public function it_correctly_handles_converter_priorities() { $this->app['config']->set('laravel-xml.converters.custom.models', ['priority' => 1000, 'value' => CustomConverter::class]); $this->app['config']->set('laravel-xml.converters.custom.objects', ['priority' => 1001, 'value' => CustomConverter::class]); $this->app['config']->set('laravel-xml.converters.custom.collections', ['priority' => 1001, 'value' => CustomConverter::class]); $this->app['config']->set('laravel-xml.converters.custom.Illuminate\\Database\\Eloquent\\Collection', ['priority' => 1001, 'value' => CustomCollectionConverter::class]); $this->app['config']->set('laravel-xml.converters.custom.TestObject', ['priority' => 1001, 'value' => CustomObjectConverter::class]); $this->assertEquals(CustomConverter::class, Xml::getConverterFor(new Collection())); $this->assertInstanceOf(CustomConverter::class, app(Xml::getConverterFor(new Collection()))); $this->assertEquals(CustomCollectionConverter::class, Xml::getConverterFor(new \Illuminate\Database\Eloquent\Collection())); $this->assertInstanceOf(CustomCollectionConverter::class, app(Xml::getConverterFor(new \Illuminate\Database\Eloquent\Collection()))); $this->assertEquals(CustomConverter::class, Xml::getConverterFor(new TestModel())); $this->assertInstanceOf(CustomConverter::class, app(Xml::getConverterFor(new TestModel()))); $this->assertEquals(CustomObjectConverter::class, Xml::getConverterFor(new TestObject())); $this->assertInstanceOf(CustomObjectConverter::class, app(Xml::getConverterFor(new TestObject()))); }