Created
January 29, 2014 18:02
-
-
Save gpfiel/8693422 to your computer and use it in GitHub Desktop.
Unit testing how to know if the post result has success
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace ApplicationTest\Controller; | |
use Zend\Test\PHPUnit\Controller\AbstractHttpControllerTestCase; | |
class LoginControllerTeste extends AbstractHttpControllerTestCase | |
{ | |
public function setUp() | |
{ | |
$this->setApplicationConfig( | |
include 'C:/wamp/www/extranet/config/application.config.php' | |
); | |
parent::setUp(); | |
} | |
public function testAcaoLogin() | |
{ | |
$this->dispatch('/login'); | |
$this->assertResponseStatusCode(200); | |
$this->assertModuleName('Application'); | |
$this->assertControllerName('Application\Controller\Login'); | |
$this->assertControllerClass('LoginController'); | |
$this->assertMatchedRouteName('login'); | |
$dadosLogin = array("email" => "[email protected]", "senha" => "123456"); | |
$this->dispatch('/login', 'POST', $dadosLogin); | |
$this->assertRedirectTo('/login/'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment