2014-10-13 09:10:57 +01:00
|
|
|
<?php
|
|
|
|
|
2016-10-14 14:30:05 +13:00
|
|
|
namespace SilverStripe\Control\Tests;
|
2016-08-19 10:51:35 +12:00
|
|
|
|
2019-02-27 14:50:49 +13:00
|
|
|
use SilverStripe\Core\Injector\Injector;
|
|
|
|
use SilverStripe\Core\Kernel;
|
2017-06-23 12:29:11 +12:00
|
|
|
use SilverStripe\Control\Tests\FlushMiddlewareTest\TestFlushable;
|
2016-10-14 14:30:05 +13:00
|
|
|
use SilverStripe\Dev\FunctionalTest;
|
2016-08-19 10:51:35 +12:00
|
|
|
|
2017-06-23 12:29:11 +12:00
|
|
|
class FlushMiddlewareTest extends FunctionalTest
|
2016-12-16 17:34:21 +13:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Assert that classes that implement flushable are called
|
|
|
|
*/
|
|
|
|
public function testImplementorsAreCalled()
|
|
|
|
{
|
2017-01-26 11:34:39 +13:00
|
|
|
TestFlushable::$flushed = false;
|
2019-02-27 14:50:49 +13:00
|
|
|
|
|
|
|
Injector::inst()->get(Kernel::class)->boot(true);
|
|
|
|
$this->get('/');
|
2017-01-26 11:34:39 +13:00
|
|
|
$this->assertTrue(TestFlushable::$flushed);
|
2019-02-27 14:50:49 +13:00
|
|
|
|
|
|
|
// reset the kernel Flush flag
|
|
|
|
Injector::inst()->get(Kernel::class)->boot();
|
2016-12-16 17:34:21 +13:00
|
|
|
}
|
2014-10-13 09:10:57 +01:00
|
|
|
}
|