2012-04-12 10 views
0

Wie kann ich eine HTML/XML-Ausgabe von einer Controller-Aktion in meinem Testfall wiedergeben?Zend_Test_PHPUnit Wie wird die Ausnahme/Ausgabe gedruckt?

Hier ist mein Testfall:

public function testCreateAccountIsASuccessfulRequest() 
{ 
    $this->dispatch('/v2/user/create-account'); 

    $this->assertFalse($this->response->isException()); 

    $this->assertNotRedirect(); 
} 

Welche dies in Kommandozeile druckt:

test# /usr/local/bin/phpunit --verbose Controllers_UserControllerTest.php 
PHPUnit 3.6.10 by Sebastian Bergmann. 

F 

Time: 0 seconds, Memory: 12.50Mb 

There was 1 failure: 

1) Controllers_UserControllerTest::testCreateAccountIsASuccessfulRequest 
Failed asserting that true is false. 

/path/to/tests/Controllers/UserControllerTest.php:17 
/usr/local/bin/phpunit:46 

FAILURES! 
Tests: 1, Assertions: 1, Failures: 1. 
test# 

Ich bin nicht sicher, was die eigentliche Ausnahme. Wie man es sieht? Wie kann ich die tatsächliche Ausgabe der Controller-Aktion sehen? Also HTML/XML sendet es an den Browser?

Antwort

0

Gott, ich bin langsam heute:

public function testCreateAccountIsASuccessfulRequest() 
{ 
    $this->dispatch('/v2/user/create-account'); 

    echo $this->getResponse()->getBody(); 

    $this->assertFalse($this->response->isException()); 

    $this->assertNotRedirect(); 
} 
Verwandte Themen