mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-20 16:40:10 +00:00
Expand test code.
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
namespace Tests\Api\Models\Transaction;
|
||||
|
||||
|
||||
use DateTimeInterface;
|
||||
use Faker\Factory;
|
||||
use Laravel\Passport\Passport;
|
||||
use Log;
|
||||
@@ -37,6 +38,15 @@ class StoreControllerTest extends TestCase
|
||||
{
|
||||
use RandomValues, TestHelpers, CollectsValues;
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function emptyDataProvider(): array
|
||||
{
|
||||
return [[[]]];
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@@ -47,32 +57,6 @@ class StoreControllerTest extends TestCase
|
||||
Log::info(sprintf('Now in %s.', get_class($this)));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param array $submission
|
||||
*
|
||||
* emptyDataProvider / storeDataProvider
|
||||
*
|
||||
* @dataProvider storeDataProvider
|
||||
*/
|
||||
public function testStore(array $submission): void
|
||||
{
|
||||
if ([] === $submission) {
|
||||
$this->markTestSkipped('Empty data provider');
|
||||
}
|
||||
$route = 'api.v1.transactions.store';
|
||||
$this->storeAndCompare($route, $submission);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function emptyDataProvider(): array
|
||||
{
|
||||
return [[[]]];
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
@@ -117,7 +101,7 @@ class StoreControllerTest extends TestCase
|
||||
'transactions' => [
|
||||
[
|
||||
'type' => $combi[0],
|
||||
'date' => $faker->dateTime(null, 'Europe/Amsterdam')->format(\DateTimeInterface::RFC3339),
|
||||
'date' => $faker->dateTime(null, 'Europe/Amsterdam')->format(DateTimeInterface::RFC3339),
|
||||
'amount' => number_format($faker->randomFloat(2, 10, 100), 12),
|
||||
'description' => $faker->uuid,
|
||||
'source_id' => $combi[1],
|
||||
@@ -131,7 +115,6 @@ class StoreControllerTest extends TestCase
|
||||
return $set;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return \array[][]
|
||||
*/
|
||||
@@ -211,4 +194,20 @@ class StoreControllerTest extends TestCase
|
||||
return $set;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $submission
|
||||
*
|
||||
* emptyDataProvider / storeDataProvider
|
||||
*
|
||||
* @dataProvider storeDataProvider
|
||||
*/
|
||||
public function testStore(array $submission): void
|
||||
{
|
||||
if ([] === $submission) {
|
||||
$this->markTestSkipped('Empty data provider');
|
||||
}
|
||||
$route = 'api.v1.transactions.store';
|
||||
$this->storeAndCompare($route, $submission);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user