gitea_issues_exporter/tests/CsvGenerationTest.php

42 lines
1.1 KiB
PHP
Raw Normal View History

2024-07-22 14:17:00 +02:00
<?php
namespace Tests;
use Tests\TestCase;
use Laravel\Lumen\Testing\DatabaseMigrations;
use Laravel\Lumen\Testing\DatabaseTransactions;
class CsvGenerationTest extends TestCase
{
public function test_export_contains_correct_data()
{
$res = $this->post('/backend', array(
'organization' => 'GruppoCO',
'password' => getenv('APP_PASSWORD')
));
$res->assertResponseOk();
$beginningDateYear = '2024' ;
$beginningDateMonth = '04';
$endDateYear = '2024';
$endDateMonth = '05';
$issueType = 'closed';
$generatedCsv = $this->post('/export', array(
'from_year' => $beginningDateYear,
'from_month' => $beginningDateMonth,
'to_year' => $endDateYear,
'to_month' => $endDateMonth,
'issues_type' => $issueType,
));
$res->assertResponseOK();
$generatedCsvHash = md5_file($generatedCsv);
$testFileHash = '07078b8e24768453b1e45236b13d347d';
assertEquals($generatedCsvHash, $testFileHash);
}
}