This repository was archived by the owner on Jan 29, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +14
-7
lines changed Expand file tree Collapse file tree 2 files changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -458,15 +458,16 @@ public function getFinalHandler(ResponseInterface $response = null)
458458 /**
459459 * Retrieve an emitter to use during run().
460460 *
461- * If none was registered during instantiation, this will lazy-load a
462- * SapiEmitter instance.
461+ * If none was registered during instantiation, this will lazy-load an
462+ * EmitterStack composing an SapiEmitter instance.
463463 *
464464 * @return EmitterInterface
465465 */
466466 public function getEmitter ()
467467 {
468468 if (! $ this ->emitter ) {
469- $ this ->emitter = new SapiEmitter ;
469+ $ this ->emitter = new Emitter \EmitterStack ();
470+ $ this ->emitter ->push (new SapiEmitter ());
470471 }
471472 return $ this ->emitter ;
472473 }
Original file line number Diff line number Diff line change 1313use PHPUnit_Framework_TestCase as TestCase ;
1414use Prophecy \Argument ;
1515use ReflectionProperty ;
16+ use Zend \Diactoros \Response \SapiEmitter ;
1617use Zend \Diactoros \ServerRequest as Request ;
1718use Zend \Expressive \Application ;
19+ use Zend \Expressive \Emitter \EmitterStack ;
1820use Zend \Expressive \Router \Route ;
1921use Zend \Expressive \Router \RouteResult ;
2022use Zend \Stratigility \Route as StratigilityRoute ;
@@ -260,11 +262,15 @@ public function testFinalHandlerIsUsedAtInvocationIfNoOutArgumentIsSupplied()
260262 $ this ->assertSame ($ finalResponse , $ test );
261263 }
262264
263- public function testComposesSapiEmitterByDefault ()
265+ public function testComposesEmitterStackWithSapiEmitterByDefault ()
264266 {
265- $ app = $ this ->getApp ();
266- $ emitter = $ app ->getEmitter ();
267- $ this ->assertInstanceOf ('Zend\Diactoros\Response\SapiEmitter ' , $ emitter );
267+ $ app = $ this ->getApp ();
268+ $ stack = $ app ->getEmitter ();
269+ $ this ->assertInstanceOf (EmitterStack::class, $ stack );
270+
271+ $ this ->assertCount (1 , $ stack );
272+ $ test = $ stack ->pop ();
273+ $ this ->assertInstanceOf (SapiEmitter::class, $ test );
268274 }
269275
270276 public function testAllowsInjectingEmitterAtInstantiation ()
You can’t perform that action at this time.
0 commit comments