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.
 
 

40 lines
1.2 KiB

<?php
namespace Tests\Functional;
class HomepageTest extends BaseTestCase
{
/**
* Test that the index route returns a rendered response containing the text 'SlimFramework' but not a greeting
*/
public function testGetHomepageWithoutName()
{
$response = $this->runApp('GET', '/');
$this->assertEquals(200, $response->getStatusCode());
$this->assertContains('SlimFramework', (string)$response->getBody());
$this->assertNotContains('Hello', (string)$response->getBody());
}
/**
* Test that the index route with optional name argument returns a rendered greeting
*/
public function testGetHomepageWithGreeting()
{
$response = $this->runApp('GET', '/name');
$this->assertEquals(200, $response->getStatusCode());
$this->assertContains('Hello name!', (string)$response->getBody());
}
/**
* Test that the index route won't accept a post request
*/
public function testPostHomepageNotAllowed()
{
$response = $this->runApp('POST', '/', ['test']);
$this->assertEquals(405, $response->getStatusCode());
$this->assertContains('Method not allowed', (string)$response->getBody());
}
}