Tests
This commit is contained in:
@ -15,7 +15,10 @@
|
||||
<directory>tests/units</directory>
|
||||
</testsuite>
|
||||
<testsuite name="acceptance">
|
||||
<directory>tests/acceptance</directory>
|
||||
<directory>tests/integration</directory>
|
||||
</testsuite>
|
||||
<testsuite name="performance">
|
||||
<directory>tests/performance</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
|
||||
|
@ -1,22 +0,0 @@
|
||||
<?php
|
||||
use PHPUnit\Framework;
|
||||
|
||||
class HomeTest extends Framework\TestCase
|
||||
{
|
||||
public function testLoadHome(): void
|
||||
{
|
||||
$client = new GuzzleHttp\Client(['base_uri' => 'http://proxy']);
|
||||
$home = $client->get('');
|
||||
$home = $home->getBody()->getContents();
|
||||
|
||||
$expected = [
|
||||
'<!DOCTYPE html>',
|
||||
'<title>Incoviba</title>',
|
||||
'<img src="http://localhost:8080/assets/images/logo_cabezal.png" alt="logo" />',
|
||||
'Bienvenid@ a Incoviba'
|
||||
];
|
||||
foreach ($expected as $segment) {
|
||||
$this->assertStringContainsString($segment, $home);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
<?php
|
||||
use PHPUnit\Framework;
|
||||
|
||||
class LoginTest extends Framework\TestCase
|
||||
{
|
||||
public function testShowLogin(): void
|
||||
{
|
||||
$client = $this->getClient();
|
||||
$response = $client->get('/login');
|
||||
$login = $response->getBody()->getContents();
|
||||
$expected = [
|
||||
'<input type="text" id="name" name="name" />',
|
||||
'<input type="password" id="password" name="password" />',
|
||||
'<button class="ui button" id="enter">Ingresar</button>'
|
||||
];
|
||||
foreach ($expected as $segment) {
|
||||
$this->assertStringContainsString($segment, $login);
|
||||
}
|
||||
}
|
||||
public function testDoLogin(): void
|
||||
{
|
||||
$client = $this->getClient();
|
||||
$response = $client->get('/login');
|
||||
}
|
||||
|
||||
protected function getClient(): GuzzleHttp\Client
|
||||
{
|
||||
return new GuzzleHttp\Client(['base_uri' => 'http://proxy']);
|
||||
}
|
||||
}
|
17
app/tests/performance/APITest.php
Normal file
17
app/tests/performance/APITest.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
namespace ProVM\Performance;
|
||||
|
||||
use GuzzleHttp\Client;
|
||||
use PHPUnit\Framework;
|
||||
|
||||
class APITest extends Framework\TestCase
|
||||
{
|
||||
public function testLoad(): void
|
||||
{
|
||||
$client = new Client(['base_uri' => 'http://proxy']);
|
||||
$start = microtime(true);
|
||||
$response = $client->get('/api', ['headers' => ['Authorization' => 'Bearer ' . md5($_ENV['API_KEY'])]]);
|
||||
$end = microtime(true);
|
||||
$this->assertLessThanOrEqual(1000, $end - $start);
|
||||
}
|
||||
}
|
17
app/tests/performance/HomeTest.php
Normal file
17
app/tests/performance/HomeTest.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
namespace ProVM\Performance;
|
||||
|
||||
use GuzzleHttp\Client;
|
||||
use PHPUnit\Framework;
|
||||
|
||||
class HomeTest extends Framework\TestCase
|
||||
{
|
||||
public function testLoad(): void
|
||||
{
|
||||
$client = new Client(['base_uri' => 'http://proxy']);
|
||||
$start = microtime(true);
|
||||
$response = $client->get('');
|
||||
$end = microtime(true);
|
||||
$this->assertLessThanOrEqual(1000, $end - $start);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user