import v1.1.0_beta1 | 2009-08-21
This commit is contained in:
@ -19,15 +19,15 @@ class FeedbackControllerTests extends PHPUnit_Framework_TestCase
|
||||
public function setUp()
|
||||
{
|
||||
TestHarness::setUp();
|
||||
Setup::$front->returnResponse(true);
|
||||
Application::$front->returnResponse(true);
|
||||
$this->_response = new Zend_Controller_Response_Http();
|
||||
Setup::$front->setResponse($this->_response);
|
||||
Application::$front->setResponse($this->_response);
|
||||
}
|
||||
|
||||
public function testIndexAction()
|
||||
{
|
||||
Setup::$front->setRequest(new TestRequest('/feedback'));
|
||||
Setup::dispatch();
|
||||
Application::$front->setRequest(new TestRequest('/feedback'));
|
||||
Application::dispatch();
|
||||
|
||||
$this->assertContains('<form id="feedbackForm" method="post" action', $this->_response->getBody());
|
||||
}
|
||||
@ -43,10 +43,10 @@ class FeedbackControllerTests extends PHPUnit_Framework_TestCase
|
||||
'feedback' => $feedback,
|
||||
);
|
||||
|
||||
Setup::$front->setRequest(new TestRequest('/feedback/send'));
|
||||
Setup::dispatch();
|
||||
Application::$front->setRequest(new TestRequest('/feedback/send'));
|
||||
Application::dispatch();
|
||||
|
||||
$this->assertContains('Value is empty, but a non-empty value is required', $this->_response->getBody());
|
||||
$this->assertContains('Value is required and can\'t be empty', $this->_response->getBody());
|
||||
}
|
||||
|
||||
public function testSendWithBadEmailAction()
|
||||
@ -57,8 +57,8 @@ class FeedbackControllerTests extends PHPUnit_Framework_TestCase
|
||||
'feedback' => 'whateva',
|
||||
);
|
||||
|
||||
Setup::$front->setRequest(new TestRequest('/feedback/send'));
|
||||
Setup::dispatch();
|
||||
Application::$front->setRequest(new TestRequest('/feedback/send'));
|
||||
Application::dispatch();
|
||||
|
||||
$this->assertContains('is not a valid email address', $this->_response->getBody());
|
||||
}
|
||||
@ -72,8 +72,8 @@ class FeedbackControllerTests extends PHPUnit_Framework_TestCase
|
||||
'captcha' => 'whatever',
|
||||
);
|
||||
|
||||
Setup::$front->setRequest(new TestRequest('/feedback/send'));
|
||||
Setup::dispatch();
|
||||
Application::$front->setRequest(new TestRequest('/feedback/send'));
|
||||
Application::dispatch();
|
||||
|
||||
$this->assertContains('Captcha value is wrong', $this->_response->getBody());
|
||||
}
|
||||
@ -83,8 +83,8 @@ class FeedbackControllerTests extends PHPUnit_Framework_TestCase
|
||||
// I gotta render the form first to generate the captcha
|
||||
$sessionStub = new CaptchaImageTestSessionContainer();
|
||||
Zend_Registry::set('appSession', $sessionStub);
|
||||
Setup::$front->setRequest(new TestRequest('/feedback/send'));
|
||||
Setup::dispatch();
|
||||
Application::$front->setRequest(new TestRequest('/feedback/send'));
|
||||
Application::dispatch();
|
||||
$this->assertEquals(preg_match('/name="captcha\[id\]" value="([0-9a-f]+)"/', $this->_response->__toString(), $matches), 1);
|
||||
|
||||
$email = 'john_' . rand(0, 1000) . '@mailinator.com';
|
||||
@ -98,15 +98,15 @@ class FeedbackControllerTests extends PHPUnit_Framework_TestCase
|
||||
)
|
||||
);
|
||||
|
||||
Setup::$front->setRequest(new TestRequest('/feedback/send'));
|
||||
Application::$front->setRequest(new TestRequest('/feedback/send'));
|
||||
|
||||
Setup::$mockLogger->events = array();
|
||||
Application::$mockLogger->events = array();
|
||||
try {
|
||||
Setup::dispatch();
|
||||
Application::dispatch();
|
||||
} catch (Zend_Controller_Response_Exception $e) {
|
||||
// I still don't know how to avoid the "headers already sent" problem here...
|
||||
}
|
||||
$lastLog = array_pop(Setup::$mockLogger->events);
|
||||
$lastLog = array_pop(Application::$mockLogger->events);
|
||||
$this->assertEquals("redirected to ''", $lastLog['message']);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user