mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-01-10 04:21:20 +00:00
Expand test code.
This commit is contained in:
@@ -37,6 +37,15 @@ class StoreControllerTest extends TestCase
|
||||
{
|
||||
use RandomValues, TestHelpers, CollectsValues;
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function emptyDataProvider(): array
|
||||
{
|
||||
return [[[]]];
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@@ -47,32 +56,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.transaction_links.store';
|
||||
$this->storeAndCompare($route, $submission);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function emptyDataProvider(): array
|
||||
{
|
||||
return [[[]]];
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
@@ -123,7 +106,6 @@ class StoreControllerTest extends TestCase
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return \array[][]
|
||||
*/
|
||||
@@ -140,4 +122,20 @@ class StoreControllerTest extends TestCase
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $submission
|
||||
*
|
||||
* emptyDataProvider / storeDataProvider
|
||||
*
|
||||
* @dataProvider storeDataProvider
|
||||
*/
|
||||
public function testStore(array $submission): void
|
||||
{
|
||||
if ([] === $submission) {
|
||||
$this->markTestSkipped('Empty data provider');
|
||||
}
|
||||
$route = 'api.v1.transaction_links.store';
|
||||
$this->storeAndCompare($route, $submission);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -85,35 +85,35 @@ class UpdateControllerTest extends TestCase
|
||||
{
|
||||
$faker = Factory::create();
|
||||
$set = [
|
||||
'link_type_id' => [
|
||||
'link_type_id' => [
|
||||
'id' => 1,
|
||||
'fields' => [
|
||||
'link_type_id' => ['test_value' => (string)$faker->numberBetween(1,3)],
|
||||
'link_type_id' => ['test_value' => (string)$faker->numberBetween(1, 3)],
|
||||
],
|
||||
'extra_ignore' => ['link_type_name'],
|
||||
],
|
||||
'link_type_name' => [
|
||||
'link_type_name' => [
|
||||
'id' => 1,
|
||||
'fields' => [
|
||||
'link_type_name' => ['test_value' => 'Refund'],
|
||||
],
|
||||
'extra_ignore' => ['link_type_id'],
|
||||
],
|
||||
'inward_id' => [
|
||||
'inward_id' => [
|
||||
'id' => 1,
|
||||
'fields' => [
|
||||
'inward_id' => ['test_value' => (string)$faker->numberBetween(11,20)],
|
||||
'inward_id' => ['test_value' => (string)$faker->numberBetween(11, 20)],
|
||||
],
|
||||
'extra_ignore' => [],
|
||||
],
|
||||
'outward_id' => [
|
||||
'outward_id' => [
|
||||
'id' => 1,
|
||||
'fields' => [
|
||||
'outward_id' => ['test_value' => (string)$faker->numberBetween(11, 30)],
|
||||
],
|
||||
'extra_ignore' => [],
|
||||
],
|
||||
'notes' => [
|
||||
'notes' => [
|
||||
'id' => 1,
|
||||
'fields' => [
|
||||
'notes' => ['test_value' => join(' ', $faker->words(5))],
|
||||
|
||||
Reference in New Issue
Block a user