Skip to content

Commit

Permalink
Reset middleware on each test
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickbrouwers committed Jan 16, 2024
1 parent 27afa36 commit b55a1b4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .phpunit.cache/test-results

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/Cell.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,6 @@ public function getValue($nullValue = null, $calculateFormulas = false, $formatD
}
}

return resolve(Pipeline::class)->through(config('excel.imports.cells.middleware', []))->thenReturn();
return resolve(Pipeline::class)->send($value)->through(config('excel.imports.cells.middleware', []))->thenReturn();
}
}
6 changes: 6 additions & 0 deletions tests/CellTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ class CellTest extends TestCase
*/
public function can_get_cell_value()
{
config()->set('excel.imports.cells.middleware', []);

$worksheet = $this->read(__DIR__ . '/Data/Disks/Local/import-middleware.xlsx', 'Xlsx');

$this->assertEquals('test', Cell::make($worksheet->getActiveSheet(), 'A1')->getValue());
Expand All @@ -33,6 +35,8 @@ public function can_trim_empty_cells()
$worksheet = $this->read(__DIR__ . '/Data/Disks/Local/import-middleware.xlsx', 'Xlsx');

$this->assertEquals('', Cell::make($worksheet->getActiveSheet(), 'A2')->getValue());

config()->set('excel.imports.cells.middleware', []);
}

/**
Expand All @@ -48,5 +52,7 @@ public function convert_empty_cells_to_null()
$worksheet = $this->read(__DIR__ . '/Data/Disks/Local/import-middleware.xlsx', 'Xlsx');

$this->assertEquals(null, Cell::make($worksheet->getActiveSheet(), 'A2')->getValue());

config()->set('excel.imports.cells.middleware', []);
}
}

0 comments on commit b55a1b4

Please sign in to comment.