有没有办法测试 Magento POST 控制器的动作?例如客户登录:
Mage_Customer_AccountController::loginPostAction()
我正在使用 EcomDev_PHPUnit 模块进行测试。它适用于基本操作,但我无法调用 POST 操作。
$this->getRequest()->setMethod('POST');
// ivokes loginAction instead loginPostAction
$this->dispatch('customer/account/login');
// fails also
$this->dispatch('customer/account/loginPost');
// but this assert pass
$this->assertEquals('POST', $_SERVER['REQUEST_METHOD']);
我想让测试或多或少像
// ... some setup
$this->getRequest()->setMethod('POST');
$this->dispatch('customer/account/login');
// since login uses singleton, then...
$session = Mage::getSingleton('customer/session');
$this->assertTrue($session->isLoggedIn());