Created
October 2, 2022 04:18
-
-
Save alexandreelise/fff297d0159c5ae5317f3e61e3c88745 to your computer and use it in GitHub Desktop.
SmokeTest using PhpUnit and Joomla Framework Http package
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
<?php | |
namespace AlexApi\Tests; | |
use Generator; | |
use Joomla\Http\HttpFactory; | |
use Joomla\Uri\Uri; | |
use PHPUnit\Framework\TestCase; | |
class SmokeTest extends TestCase | |
{ | |
/** | |
* @dataProvider urlProvider | |
*/ | |
public function testPageIsSuccessful($path, $query) | |
{ | |
$client = (new HttpFactory())->getAvailableDriver(); | |
$uri = new Uri('https://example.org'); | |
$uri->setPath($path); | |
$uri->setQuery($query); | |
$response = $client->request('GET', $uri); | |
$this->assertSame(200, $response->getStatusCode()); | |
} | |
/** | |
* @return \Generator | |
*/ | |
public function urlProvider(): Generator | |
{ | |
yield ['/', '']; | |
yield ['/administrator', '']; | |
yield ['/sample-1', '']; | |
yield ['/your-favorite-cms', '']; | |
yield ['/blog', '']; | |
yield ['/contact', '']; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment