@@ -77,7 +77,7 @@ public function testLackOfConfigServiceResultsInFactoryUsingDefaults() : void
7777 $ this ->assertInstanceOf (ProblemDetailsResponseFactory::class, $ factory );
7878 $ this ->assertAttributeSame (ProblemDetailsResponseFactory::EXCLUDE_THROWABLE_DETAILS , 'isDebug ' , $ factory );
7979 $ this ->assertAttributeSame (
80- JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_PRESERVE_ZERO_FRACTION ,
80+ JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_PRESERVE_ZERO_FRACTION ,
8181 'jsonFlags ' ,
8282 $ factory
8383 );
@@ -86,6 +86,25 @@ public function testLackOfConfigServiceResultsInFactoryUsingDefaults() : void
8686 $ this ->assertResponseFactoryReturns ($ response , $ factory );
8787 }
8888
89+ public function testUsesPrettyPrintFlagOnEnabledDebugMode () : void
90+ {
91+ $ this ->container ->has ('config ' )->willReturn (true );
92+ $ this ->container ->get ('config ' )->willReturn ([
93+ 'debug ' => true ,
94+ ]);
95+ $ this ->container ->has (ResponseInterface::class)->willReturn (false );
96+ $ this ->container ->has ('Zend\ProblemDetails\StreamFactory ' )->willReturn (false );
97+
98+ $ factoryFactory = new ProblemDetailsResponseFactoryFactory ();
99+ $ factory = $ factoryFactory ($ this ->container ->reveal ());
100+
101+ $ this ->assertAttributeSame (
102+ JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_PRESERVE_ZERO_FRACTION ,
103+ 'jsonFlags ' ,
104+ $ factory
105+ );
106+ }
107+
89108 public function testUsesDebugSettingFromConfigWhenPresent () : void
90109 {
91110 $ this ->container ->has ('config ' )->willReturn (true );
0 commit comments