generated from dev/symfony-5-cli-template
Implementation a microservice architecture with JSON-RPC 2.0 communication between backend and frontend https://www.jsonrpc.org/specification
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.
60 lines
1.6 KiB
60 lines
1.6 KiB
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Tests\acceptance\Controller;
|
|
|
|
use App\Tests\AcceptanceTester;
|
|
use Codeception\Example;
|
|
use DateTime;
|
|
|
|
class IndexControllerCest
|
|
{
|
|
private AcceptanceTester $tester;
|
|
|
|
public function _before(AcceptanceTester $tester): void
|
|
{
|
|
$this->tester = $tester;
|
|
}
|
|
|
|
public function testBaseAvailability(): void
|
|
{
|
|
$this->tester->amOnPage('/');
|
|
$this->tester->seeResponseCodeIs(200);
|
|
}
|
|
|
|
/**
|
|
* @dataProvider dataDateForm
|
|
*/
|
|
public function testDateForm(Example $example): void
|
|
{
|
|
$this->tester->amOnPage('/');
|
|
$this->tester->fillField("//input[@id='weather_form_date']", $example['fillField']);
|
|
$this->tester->click('Send');
|
|
$this->tester->seeCurrentUrlEquals('/');
|
|
$this->tester->seeResponseCodeIs(200);
|
|
$this->tester->see($example['see']);
|
|
}
|
|
|
|
protected function dataDateForm(): array
|
|
{
|
|
return [
|
|
[
|
|
'fillField' => (new DateTime())->format('Y-m-d'),
|
|
'see' => 'градусов',
|
|
],
|
|
[
|
|
'fillField' => '9999-01-01',
|
|
'see' => 'Температура за указанный день не указана',
|
|
],
|
|
];
|
|
}
|
|
|
|
public function testWeatherTable(): void
|
|
{
|
|
$this->tester->amOnPage('/');
|
|
$this->tester->see('Погода за последние 30 дней');
|
|
$this->tester->see('Дата', '//th');
|
|
$this->tester->see('Температура', '//th');
|
|
}
|
|
}
|