yii\base\View::endCache PHP Method

endCache() public method

Ends fragment caching.
public endCache ( )
    public function endCache()
    {
        FragmentCache::end();
    }

Usage Example

Beispiel #1
0
 public function testCacheDisabled2()
 {
     $expectedLevel = ob_get_level();
     ob_start();
     ob_implicit_flush(false);
     $view = new View();
     $this->assertTrue($view->beginCache('test'));
     echo "cached fragment";
     $view->endCache();
     ob_start();
     ob_implicit_flush(false);
     $this->assertTrue($view->beginCache('test', ['enabled' => false]));
     echo "cached fragment other";
     $view->endCache();
     $this->assertEquals("cached fragment other", ob_get_clean());
     ob_end_clean();
     $this->assertEquals($expectedLevel, ob_get_level(), 'Output buffer not closed correctly.');
 }