Improve randomness in test data to prevent key collisions.

This commit is contained in:
James Cole
2018-07-14 16:41:07 +02:00
parent ff403dfa2e
commit 3d1523a060
50 changed files with 283 additions and 283 deletions

View File

@@ -162,9 +162,9 @@ class LinkControllerTest extends TestCase
{
$repository = $this->mock(LinkTypeRepositoryInterface::class);
$data = [
'name' => 'test ' . random_int(1, 1000),
'inward' => 'test inward' . random_int(1, 1000),
'outward' => 'test outward' . random_int(1, 1000),
'name' => 'test ' . random_int(1, 10000),
'inward' => 'test inward' . random_int(1, 10000),
'outward' => 'test outward' . random_int(1, 10000),
];
$repository->shouldReceive('store')->once()->andReturn(LinkType::first());
$repository->shouldReceive('findNull')->andReturn(LinkType::first());
@@ -184,9 +184,9 @@ class LinkControllerTest extends TestCase
{
$repository = $this->mock(LinkTypeRepositoryInterface::class);
$data = [
'name' => 'test ' . random_int(1, 1000),
'inward' => 'test inward' . random_int(1, 1000),
'outward' => 'test outward' . random_int(1, 1000),
'name' => 'test ' . random_int(1, 10000),
'inward' => 'test inward' . random_int(1, 10000),
'outward' => 'test outward' . random_int(1, 10000),
'create_another' => '1',
];
$repository->shouldReceive('store')->once()->andReturn(new LinkType);
@@ -210,9 +210,9 @@ class LinkControllerTest extends TestCase
$repository->shouldReceive('update')->once()->andReturn(new $linkType);
$data = [
'name' => 'test ' . random_int(1, 1000),
'inward' => 'test inward' . random_int(1, 1000),
'outward' => 'test outward' . random_int(1, 1000),
'name' => 'test ' . random_int(1, 10000),
'inward' => 'test inward' . random_int(1, 10000),
'outward' => 'test outward' . random_int(1, 10000),
];
$this->session(['link_types.edit.uri' => 'http://localhost']);
$this->be($this->user());
@@ -231,9 +231,9 @@ class LinkControllerTest extends TestCase
$linkType = LinkType::where('editable', 0)->first();
$data = [
'name' => 'test ' . random_int(1, 1000),
'inward' => 'test inward' . random_int(1, 1000),
'outward' => 'test outward' . random_int(1, 1000),
'name' => 'test ' . random_int(1, 10000),
'inward' => 'test inward' . random_int(1, 10000),
'outward' => 'test outward' . random_int(1, 10000),
'return_to_edit' => '1',
];
$this->session(['link_types.edit.uri' => 'http://localhost']);
@@ -254,9 +254,9 @@ class LinkControllerTest extends TestCase
$linkType = LinkType::create(['editable' => 1, 'inward' => 'healox', 'outward' => 'byaex', 'name' => 'Test tyapeX']);
$data = [
'name' => 'test ' . random_int(1, 1000),
'inward' => 'test inward' . random_int(1, 1000),
'outward' => 'test outward' . random_int(1, 1000),
'name' => 'test ' . random_int(1, 10000),
'inward' => 'test inward' . random_int(1, 10000),
'outward' => 'test outward' . random_int(1, 10000),
'return_to_edit' => '1',
];
$repository->shouldReceive('update')->once()->andReturn(new $linkType);

View File

@@ -209,7 +209,7 @@ class IndexControllerTest extends TestCase
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'dc_' . random_int(1, 1000);
$job->key = 'dc_' . random_int(1, 10000);
$job->status = 'ready_to_run';
$job->stage = 'go-for-import';
$job->provider = 'file';

View File

@@ -53,7 +53,7 @@ class JobConfigurationControllerTest extends TestCase
{
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = '1Afake_job_' . random_int(1, 1000);
$job->key = '1Afake_job_' . random_int(1, 10000);
$job->status = 'has_prereq';
$job->provider = 'fake';
$job->file_type = '';
@@ -85,7 +85,7 @@ class JobConfigurationControllerTest extends TestCase
{
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = '2Bfake_job_' . random_int(1, 1000);
$job->key = '2Bfake_job_' . random_int(1, 10000);
$job->status = 'some_bad_state';
$job->provider = 'fake';
$job->file_type = '';
@@ -111,7 +111,7 @@ class JobConfigurationControllerTest extends TestCase
{
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = '3Cfake_job_' . random_int(1, 1000);
$job->key = '3Cfake_job_' . random_int(1, 10000);
$job->status = 'has_prereq';
$job->provider = 'fake';
$job->file_type = '';
@@ -140,7 +140,7 @@ class JobConfigurationControllerTest extends TestCase
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = '4Dfake_job_' . random_int(1, 1000);
$job->key = '4Dfake_job_' . random_int(1, 10000);
$job->status = 'has_prereq';
$job->provider = 'fake';
$job->file_type = '';
@@ -174,7 +174,7 @@ class JobConfigurationControllerTest extends TestCase
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = '5Ffake_job_' . random_int(1, 1000);
$job->key = '5Ffake_job_' . random_int(1, 10000);
$job->status = 'some_bad_state';
$job->provider = 'fake';
$job->file_type = '';
@@ -203,7 +203,7 @@ class JobConfigurationControllerTest extends TestCase
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = '6Efake_job_' . random_int(1, 1000);
$job->key = '6Efake_job_' . random_int(1, 10000);
$job->status = 'has_prereq';
$job->provider = 'fake';
$job->file_type = '';
@@ -233,7 +233,7 @@ class JobConfigurationControllerTest extends TestCase
$file = UploadedFile::fake()->image('avatar.jpg');
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = '7Dfake_job_' . random_int(1, 1000);
$job->key = '7Dfake_job_' . random_int(1, 10000);
$job->status = 'has_prereq';
$job->provider = 'fake';
$job->file_type = '';

View File

@@ -58,7 +58,7 @@ class JobStatusControllerTest extends TestCase
{
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'Afake_job_' . random_int(1, 1000);
$job->key = 'Afake_job_' . random_int(1, 10000);
$job->status = 'ready_to_run';
$job->provider = 'fake';
$job->file_type = '';
@@ -78,7 +78,7 @@ class JobStatusControllerTest extends TestCase
{
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'Bfake_job_' . random_int(1, 1000);
$job->key = 'Bfake_job_' . random_int(1, 10000);
$job->status = 'ready_to_run';
$job->provider = 'file';
$job->transactions = [];
@@ -102,7 +102,7 @@ class JobStatusControllerTest extends TestCase
$tag = $this->user()->tags()->first();
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'Cfake_job_' . random_int(1, 1000);
$job->key = 'Cfake_job_' . random_int(1, 10000);
$job->status = 'ready_to_run';
$job->provider = 'fake';
$job->transactions = [];
@@ -132,7 +132,7 @@ class JobStatusControllerTest extends TestCase
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'Dfake_job_' . random_int(1, 1000);
$job->key = 'Dfake_job_' . random_int(1, 10000);
$job->status = 'ready_to_run';
$job->provider = 'fake';
$job->transactions = [];
@@ -161,7 +161,7 @@ class JobStatusControllerTest extends TestCase
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'Efake_job_' . random_int(1, 1000);
$job->key = 'Efake_job_' . random_int(1, 10000);
$job->status = 'ready_to_run';
$job->provider = 'fake';
$job->transactions = [];
@@ -185,7 +185,7 @@ class JobStatusControllerTest extends TestCase
{
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'Ffake_job_' . random_int(1, 1000);
$job->key = 'Ffake_job_' . random_int(1, 10000);
$job->status = 'ready_to_run';
$job->provider = 'fake';
$job->transactions = [];
@@ -214,7 +214,7 @@ class JobStatusControllerTest extends TestCase
{
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'Gfake_job_' . random_int(1, 1000);
$job->key = 'Gfake_job_' . random_int(1, 10000);
$job->status = 'ready_to_run';
$job->provider = 'fake';
$job->transactions = [];
@@ -244,7 +244,7 @@ class JobStatusControllerTest extends TestCase
{
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'Hfake_job_' . random_int(1, 1000);
$job->key = 'Hfake_job_' . random_int(1, 10000);
$job->status = 'ready_to_run';
$job->provider = 'fake';
$job->transactions = [];
@@ -274,7 +274,7 @@ class JobStatusControllerTest extends TestCase
{
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'Ifake_job_' . random_int(1, 1000);
$job->key = 'Ifake_job_' . random_int(1, 10000);
$job->status = 'bad_state';
$job->provider = 'fake';
$job->transactions = [];
@@ -295,7 +295,7 @@ class JobStatusControllerTest extends TestCase
{
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'Jfake_job_' . random_int(1, 1000);
$job->key = 'Jfake_job_' . random_int(1, 10000);
$job->status = 'provider_finished';
$job->provider = 'fake';
$job->transactions = [];
@@ -326,7 +326,7 @@ class JobStatusControllerTest extends TestCase
{
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'Lfake_job_' . random_int(1, 1000);
$job->key = 'Lfake_job_' . random_int(1, 10000);
$job->status = 'provider_finished';
$job->provider = 'fake';
$job->transactions = [];
@@ -357,7 +357,7 @@ class JobStatusControllerTest extends TestCase
{
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'Kfake_job_' . random_int(1, 1000);
$job->key = 'Kfake_job_' . random_int(1, 10000);
$job->status = 'some_bad_state';
$job->provider = 'fake';
$job->transactions = [];

View File

@@ -55,7 +55,7 @@ class PrerequisitesControllerTest extends TestCase
{
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'A_pre_job_' . random_int(1, 1000);
$job->key = 'A_pre_job_' . random_int(1, 10000);
$job->status = 'new';
$job->provider = 'fake';
$job->transactions = [];
@@ -85,7 +85,7 @@ class PrerequisitesControllerTest extends TestCase
{
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'B_pre_job_' . random_int(1, 1000);
$job->key = 'B_pre_job_' . random_int(1, 10000);
$job->status = 'some_Bad_state';
$job->provider = 'fake';
$job->transactions = [];
@@ -105,7 +105,7 @@ class PrerequisitesControllerTest extends TestCase
{
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'C_pre_job_' . random_int(1, 1000);
$job->key = 'C_pre_job_' . random_int(1, 10000);
$job->status = 'new';
$job->provider = 'fake';
$job->transactions = [];
@@ -136,7 +136,7 @@ class PrerequisitesControllerTest extends TestCase
{
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'D_pre_job_' . random_int(1, 1000);
$job->key = 'D_pre_job_' . random_int(1, 10000);
$job->status = 'new';
$job->provider = 'fake';
$job->transactions = [];
@@ -166,7 +166,7 @@ class PrerequisitesControllerTest extends TestCase
{
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'D_pre_job_' . random_int(1, 1000);
$job->key = 'D_pre_job_' . random_int(1, 10000);
$job->status = 'badstate';
$job->provider = 'fake';
$job->transactions = [];
@@ -213,7 +213,7 @@ class PrerequisitesControllerTest extends TestCase
{
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'D_pre_job_' . random_int(1, 1000);
$job->key = 'D_pre_job_' . random_int(1, 10000);
$job->status = 'new';
$job->provider = 'fake';
$job->transactions = [];