PostTest.php 685 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. class PostTest extends WebTestCase
  3. {
  4. /**
  5. * We use the 'Post' only for this test.
  6. * @see CWebTestCase::fixtures
  7. */
  8. public $fixtures=array(
  9. 'posts'=>'Post',
  10. );
  11. public function testIndex()
  12. {
  13. $this->open('');
  14. // verify header title exists
  15. $this->assertTextPresent('Yii Blog Demo');
  16. // verify the sample post title exists
  17. $this->assertTextPresent($this->posts['sample1']['title']);
  18. }
  19. public function testView()
  20. {
  21. $this->open('post/1/xyz');
  22. // verify the sample post title exists
  23. $this->assertTextPresent($this->posts['sample1']['title']);
  24. // verify comment form exists
  25. $this->assertTextPresent('Leave a Comment');
  26. }
  27. }