Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Commit e178a9e

Browse files
committed
Added test to cover how the default types map is consumed from config
1 parent dadaccb commit e178a9e

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

test/ProblemDetailsResponseFactoryFactoryTest.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,4 +139,23 @@ public function testUsesJsonFlagsSettingFromConfigWhenPresent() : void
139139
$this->assertInstanceOf(ProblemDetailsResponseFactory::class, $factory);
140140
$this->assertAttributeSame(JSON_PRETTY_PRINT, 'jsonFlags', $factory);
141141
}
142+
143+
public function testUsesDefaultTypesSettingFromConfigWhenPresent() : void
144+
{
145+
$expectedDefaultTypes = [
146+
404 => 'https://example.com/problem-details/error/not-found',
147+
];
148+
149+
$this->container->has('config')->willReturn(true);
150+
$this->container->get('config')->willReturn(['problem-details' => ['default_types' => $expectedDefaultTypes]]);
151+
152+
$this->container->get(ResponseInterface::class)->willReturn(function () {
153+
});
154+
155+
$factoryFactory = new ProblemDetailsResponseFactoryFactory();
156+
$factory = $factoryFactory($this->container->reveal());
157+
158+
$this->assertInstanceOf(ProblemDetailsResponseFactory::class, $factory);
159+
$this->assertAttributeSame($expectedDefaultTypes, 'defaultTypes', $factory);
160+
}
142161
}

0 commit comments

Comments
 (0)