Created
November 9, 2012 07:45
-
-
Save lolgzs/4044294 to your computer and use it in GitHub Desktop.
Testing View PHP / Storm
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
abstract class Admin_SuggestionAchatControllerTestCase extends Admin_AbstractControllerTestCase { | |
public function setUp() { | |
parent::setUp(); | |
Storm_Test_ObjectWrapper::onLoaderOfModel('SuggestionAchat') | |
->whenCalled('findAllBy') | |
->with(['order' => 'date_creation']) | |
->answers([ | |
SuggestionAchat::newInstanceWithId(2, ['date_creation' => '2012-03-01', | |
'titre' => 'Harry Potter', | |
'auteur' => 'J.K.Rowling', | |
'isbn' => '1234567890', | |
'description_url' => 'http://harrypotter.fr', | |
'commentaire' => 'Je veux le lire']), | |
SuggestionAchat::newInstanceWithId(3, ['date_creation' => '2012-03-02', | |
'titre' => 'Millenium', | |
'auteur' =>'Stieg Larsson']) | |
]); | |
} | |
} | |
class Admin_SuggestionAchatControllerIndexTest extends Admin_SuggestionAchatControllerTestCase { | |
public function setUp() { | |
parent::setUp(); | |
$this->dispatch('/admin/suggestion-achat'); | |
} | |
/** @test */ | |
public function pageTitleShouldBeSuggestionAchat() { | |
$this->assertXPathContentContains('//h1', 'Suggestions d\'achat'); | |
} | |
/** @test */ | |
public function firstRowTDShouldContainsHarryPotter() { | |
$this->assertXPathContentContains('//tr[1]//td', 'Harry Potter'); | |
} | |
/** @test */ | |
public function firstRowTDShouldContainsJKRowling() { | |
$this->assertXPathContentContains('//tr[1]//td', 'J.K.Rowling'); | |
} | |
/** @test */ | |
public function firstRowTDShouldContainsDateCreation2012_03_01() { | |
$this->assertXPathContentContains('//tr[1]//td', '2012-03-01'); | |
} | |
/** @test */ | |
function firstRowTDShouldHaveLinkToEdit() { | |
$this->assertXPath('//tr[1]//a[contains(@href, "suggestion-achat-edit/id/2")]'); | |
} | |
/** @test */ | |
function firstRowTDShouldHaveLinkToDelete() { | |
$this->assertXPath('//tr[1]//a[contains(@href, "suggestion-achat-delete/id/2")]'); | |
} | |
/** @test */ | |
public function secondRowTDShouldContainsMillenium() { | |
$this->assertXPathContentContains('//tr[2]//td', 'Millenium'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment