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