I try to test my code with Codeception and my tests (both functional and acceptance) fails when I test logout option. They fails with "Method is not allowed (405)" because they are sent by GET method. I have this code out of the box within the Nav widget:
$menuItems[] = ['label' => 'Logout (' . Yii::$app->user->identity['username'] . ')',
'url' => ['/site/logout'],
'linkOptions' => ['data-method' => 'post']
This code works fine when I click the link by hand. In this case they are sent by POST method. But it doesn't work while testing. Why does it happens?