initital commit
This commit is contained in:
62
tests/Functional/Services/Storage/RedisStorageStoreTest.php
Normal file
62
tests/Functional/Services/Storage/RedisStorageStoreTest.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Tests\Functional\Services\Storage;
|
||||
|
||||
use App\DTO\GEOPoint;
|
||||
use App\DTO\WeatherAtTimePoint;
|
||||
use App\Services\Storage\RedisStorageStore;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||
|
||||
class RedisStorageStoreTest extends KernelTestCase
|
||||
{
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->bootKernel();
|
||||
}
|
||||
|
||||
public function testStoreAndReceiveData(): void
|
||||
{
|
||||
$dateTime = new \DateTime();
|
||||
$dateTime->setTime(0, 0);
|
||||
$tomorrowDateTime = \DateTime::createFromInterface($dateTime);
|
||||
$tomorrowDateTime->add(new \DateInterval('P1D'));
|
||||
$weatherAtTimePoints = [
|
||||
new WeatherAtTimePoint(
|
||||
$dateTime,
|
||||
10,
|
||||
-10,
|
||||
1
|
||||
),
|
||||
new WeatherAtTimePoint(
|
||||
$tomorrowDateTime,
|
||||
10,
|
||||
-10,
|
||||
1
|
||||
)
|
||||
];
|
||||
|
||||
/**
|
||||
* @var RedisStorageStore $redisStorage
|
||||
*/
|
||||
$redisStorage = $this->getContainer()->get(RedisStorageStore::class);
|
||||
$redisStorage->storeWeatherForPointByDay(
|
||||
new GEOPoint(
|
||||
24,
|
||||
24
|
||||
),
|
||||
$weatherAtTimePoints
|
||||
);
|
||||
$data = $redisStorage->receiveWeatherForPointByDay(
|
||||
new GEOPoint(
|
||||
24,
|
||||
24
|
||||
),
|
||||
$weatherAtTimePoints[0]->date,
|
||||
$weatherAtTimePoints[1]->date,
|
||||
);
|
||||
|
||||
$this->assertEquals($weatherAtTimePoints, $data);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user