From 0ae8418f32ff48c31ad94b273c43f22e4ae088cd Mon Sep 17 00:00:00 2001 From: James Cole Date: Wed, 10 Jan 2018 20:07:47 +0100 Subject: [PATCH] Fix tests. --- tests/Unit/Import/FileProcessor/CsvProcessorTest.php | 7 ++++--- tests/Unit/Middleware/BinderTest.php | 12 ++++++------ 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/tests/Unit/Import/FileProcessor/CsvProcessorTest.php b/tests/Unit/Import/FileProcessor/CsvProcessorTest.php index 515f804642..1895e85a28 100644 --- a/tests/Unit/Import/FileProcessor/CsvProcessorTest.php +++ b/tests/Unit/Import/FileProcessor/CsvProcessorTest.php @@ -43,7 +43,6 @@ class CsvProcessorTest extends TestCase */ public function testGetObjectsNoJob() { - $processor = new CsvProcessor(); $processor->getObjects(); } @@ -137,11 +136,13 @@ class CsvProcessorTest extends TestCase $repository->shouldReceive('setUser')->withArgs([Mockery::any()])->once(); $repository->shouldReceive('getConfiguration')->andReturn($config); $repository->shouldReceive('uploadFileContents')->withArgs([Mockery::any()])->andReturn($csvFile)->once(); - $repository->shouldReceive('getExtendedStatus')->twice()->andReturn([]); // twice for update errors. - $repository->shouldReceive('setExtendedStatus')->twice()->andReturn($job); + $repository->shouldReceive('getExtendedStatus')->once()->andReturn([]); // twice for update errors. + $repository->shouldReceive('setExtendedStatus')->once()->andReturn($job); + // mock stuff for this single row: $repository->shouldReceive('countByHash')->once()->withArgs([Mockery::any()])->andReturn(1); $repository->shouldReceive('addStepsDone')->once()->withArgs([Mockery::any(), 5]); + $repository->shouldReceive('addError')->once()->withArgs([Mockery::any(), 0, 'Row #0 has already been imported.']); $processor = new CsvProcessor(); $processor->setJob($job); $processor->run(); diff --git a/tests/Unit/Middleware/BinderTest.php b/tests/Unit/Middleware/BinderTest.php index f91d13cd4a..5bc6d4b006 100644 --- a/tests/Unit/Middleware/BinderTest.php +++ b/tests/Unit/Middleware/BinderTest.php @@ -309,7 +309,7 @@ class BinderTest extends TestCase public function testBudgetLimit() { Route::middleware(Binder::class)->any( - '/_test/binder/{budgetlimit}', function () { + '/_test/binder/{budgetLimit}', function () { return 'OK'; } ); @@ -328,7 +328,7 @@ class BinderTest extends TestCase public function testBudgetLimitNotFound() { Route::middleware(Binder::class)->any( - '/_test/binder/{budgetlimit}', function () { + '/_test/binder/{budgetLimit}', function () { return 'OK'; } ); @@ -347,7 +347,7 @@ class BinderTest extends TestCase public function testBudgetLimitNotLoggedIn() { Route::middleware(Binder::class)->any( - '/_test/binder/{budgetlimit}', function () { + '/_test/binder/{budgetLimit}', function () { return 'OK'; } ); @@ -1423,7 +1423,7 @@ class BinderTest extends TestCase public function testTransactionType() { Route::middleware(Binder::class)->any( - '/_test/binder/{transaction_type}', function () { + '/_test/binder/{transactionType}', function () { return 'OK'; } ); @@ -1442,7 +1442,7 @@ class BinderTest extends TestCase public function testTransactionTypeNotFound() { Route::middleware(Binder::class)->any( - '/_test/binder/{transaction_type}', function () { + '/_test/binder/{transactionType}', function () { return 'OK'; } ); @@ -1461,7 +1461,7 @@ class BinderTest extends TestCase public function testTransactionTypeNotLoggedIn() { Route::middleware(Binder::class)->any( - '/_test/binder/{transaction_type}', function () { + '/_test/binder/{transactionType}', function () { return 'OK'; } );