Push updated tests.

This commit is contained in:
James Cole
2018-03-28 19:38:20 +02:00
parent be5c44af61
commit 0a71077513
55 changed files with 344 additions and 266 deletions

View File

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

View File

@@ -103,14 +103,15 @@ class UpdateControllerTest extends TestCase
FireflyConfig::shouldReceive('set')->withArgs(['last_update_check', Mockery::any()])->once()->andReturn(new Configuration);
$version = config('firefly.version');
$date = new Carbon;
$date->subDays(5);
$releases = [
new Release(['id' => 'x', 'title' => $version . '.1', 'content' => '', 'updated' => new Carbon]),
new Release(['id' => 'x', 'title' => $version . '.1', 'content' => '', 'updated' => $date]),
];
$updater = $this->mock(UpdateRequest::class);
$updater->shouldReceive('call')->andReturnNull();
$updater->shouldReceive('getReleases')->andReturn($releases);
// expect a new release (because of .1)
$this->be($this->user());
$response = $this->post(route('admin.update-check.manual'));
$response->assertStatus(200);
@@ -130,15 +131,16 @@ class UpdateControllerTest extends TestCase
FireflyConfig::shouldReceive('get')->withArgs(['is_demo_site', false])->once()->andReturn($falseConfig);
FireflyConfig::shouldReceive('set')->withArgs(['last_update_check', Mockery::any()])->once()->andReturn(new Configuration);
$date = new Carbon;
$date->subDays(5);
$version = config('firefly.version');
$releases = [
new Release(['id' => 'x', 'title' => $version, 'content' => '', 'updated' => new Carbon]),
new Release(['id' => 'x', 'title' => $version, 'content' => '', 'updated' => $date]),
];
$updater = $this->mock(UpdateRequest::class);
$updater->shouldReceive('call')->andReturnNull();
$updater->shouldReceive('getReleases')->andReturn($releases);
// expect a new release (because of .1)
$this->be($this->user());
$response = $this->post(route('admin.update-check.manual'));
$response->assertStatus(200);
@@ -163,7 +165,6 @@ class UpdateControllerTest extends TestCase
$updater->shouldReceive('call')->andThrow(FireflyException::class, 'Something broke.');
$updater->shouldReceive('getReleases')->andReturn($releases);
// expect a new release (because of .1)
$this->be($this->user());
$response = $this->post(route('admin.update-check.manual'));
$response->assertStatus(200);