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);