A small Slim application for returning a list of pages in a MediaWiki category, ordered by Dale-Chall readability scores.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.2 KiB

  1. <?php
  2. namespace Tests\Functional;
  3. class HomepageTest extends BaseTestCase
  4. {
  5. /**
  6. * Test that the index route returns a rendered response containing the text 'SlimFramework' but not a greeting
  7. */
  8. public function testGetHomepageWithoutName()
  9. {
  10. $response = $this->runApp('GET', '/');
  11. $this->assertEquals(200, $response->getStatusCode());
  12. $this->assertContains('SlimFramework', (string)$response->getBody());
  13. $this->assertNotContains('Hello', (string)$response->getBody());
  14. }
  15. /**
  16. * Test that the index route with optional name argument returns a rendered greeting
  17. */
  18. public function testGetHomepageWithGreeting()
  19. {
  20. $response = $this->runApp('GET', '/name');
  21. $this->assertEquals(200, $response->getStatusCode());
  22. $this->assertContains('Hello name!', (string)$response->getBody());
  23. }
  24. /**
  25. * Test that the index route won't accept a post request
  26. */
  27. public function testPostHomepageNotAllowed()
  28. {
  29. $response = $this->runApp('POST', '/', ['test']);
  30. $this->assertEquals(405, $response->getStatusCode());
  31. $this->assertContains('Method not allowed', (string)$response->getBody());
  32. }
  33. }