This method is invoked right before an action is to be executed (after all possible filters.)
You may override this method to do last-minute preparation for the action.
public beforeAction ( |
||
$action | the action to be executed. | |
return | boolean | whether the action should continue to be executed. |
/** * @covers yii\filters\HttpCache::generateEtag */ public function testGenerateEtag() { $httpCache = new HttpCache(); $httpCache->etagSeed = function ($action, $params) { return ''; }; $httpCache->beforeAction(null); $response = Yii::$app->getResponse(); $this->assertTrue($response->getHeaders()->offsetExists('ETag')); $etag = $response->getHeaders()->get('ETag'); $this->assertStringStartsWith('"', $etag); $this->assertStringEndsWith('"', $etag); }