mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-22 12:11:19 +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.webhooks.store';
|
||||
$this->storeAndCompare($route, $submission);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function emptyDataProvider(): array
|
||||
{
|
||||
return [[[]]];
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
@@ -81,12 +64,12 @@ class StoreControllerTest extends TestCase
|
||||
$minimalSets = $this->minimalSets();
|
||||
$optionalSets = $this->optionalSets();
|
||||
$regenConfig = [
|
||||
'title' => function () {
|
||||
'title' => function () {
|
||||
$faker = Factory::create();
|
||||
|
||||
return $faker->uuid;
|
||||
},
|
||||
'url' => function () {
|
||||
'url' => function () {
|
||||
$faker = Factory::create();
|
||||
|
||||
return str_replace(['http://'], 'https://', $faker->url);
|
||||
@@ -138,15 +121,15 @@ class StoreControllerTest extends TestCase
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return \array[][]
|
||||
*/
|
||||
private function optionalSets(): array
|
||||
{
|
||||
$faker = Factory::create();
|
||||
|
||||
return [
|
||||
'active' => [
|
||||
'active' => [
|
||||
'fields' => [
|
||||
'active' => $faker->boolean,
|
||||
],
|
||||
@@ -154,4 +137,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.webhooks.store';
|
||||
$this->storeAndCompare($route, $submission);
|
||||
}
|
||||
|
||||
}
|
@@ -85,24 +85,26 @@ class UpdateControllerTest extends TestCase
|
||||
{
|
||||
$faker = Factory::create();
|
||||
$set = [
|
||||
'active' => [
|
||||
'active' => [
|
||||
'id' => 1,
|
||||
'fields' => [
|
||||
'active' => ['test_value' => $faker->boolean],
|
||||
],
|
||||
'extra_ignore' => [],
|
||||
],
|
||||
'title' => [
|
||||
'title' => [
|
||||
'id' => 1,
|
||||
'fields' => [
|
||||
'title' => ['test_value' => $faker->uuid],
|
||||
],
|
||||
'extra_ignore' => [],
|
||||
],
|
||||
'trigger' => [
|
||||
'trigger' => [
|
||||
'id' => 1,
|
||||
'fields' => [
|
||||
'trigger' => ['test_value' => $faker->randomElement(['TRIGGER_STORE_TRANSACTION', 'TRIGGER_UPDATE_TRANSACTION', 'TRIGGER_DESTROY_TRANSACTION'])],
|
||||
'trigger' => ['test_value' => $faker->randomElement(
|
||||
['TRIGGER_STORE_TRANSACTION', 'TRIGGER_UPDATE_TRANSACTION', 'TRIGGER_DESTROY_TRANSACTION']
|
||||
)],
|
||||
],
|
||||
'extra_ignore' => [],
|
||||
],
|
||||
@@ -120,7 +122,7 @@ class UpdateControllerTest extends TestCase
|
||||
],
|
||||
'extra_ignore' => [],
|
||||
],
|
||||
'url' => [
|
||||
'url' => [
|
||||
'id' => 1,
|
||||
'fields' => [
|
||||
'url' => ['test_value' => str_replace(['http://'], 'https://', $faker->url)],
|
||||
|
Reference in New Issue
Block a user