Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
freekmurze committed Oct 23, 2019
1 parent edb1556 commit 789aa06
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 31 deletions.
3 changes: 1 addition & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
"require": {
"php": "^7.2",
"box/spout": "^3.0",
"illuminate/support": "^6.3",
"spatie/macroable": "^1.0"
"illuminate/support": "^6.3"
},
"require-dev": {
"phpunit/phpunit": "^8.2",
Expand Down
3 changes: 0 additions & 3 deletions src/SimpleExcelReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,9 @@
use Box\Spout\Reader\ReaderInterface;
use Illuminate\Support\LazyCollection;
use Box\Spout\Reader\Common\Creator\ReaderEntityFactory;
use Spatie\Macroable\Macroable;

class SimpleExcelReader
{
use Macroable;

/** @var string */
private $path;

Expand Down
3 changes: 0 additions & 3 deletions src/SimpleExcelWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,9 @@
use Box\Spout\Writer\WriterInterface;
use Box\Spout\Common\Entity\Style\Style;
use Box\Spout\Writer\Common\Creator\WriterEntityFactory;
use Spatie\Macroable\Macroable;

class SimpleExcelWriter
{
use Macroable;

/** @var \Box\Spout\Writer\WriterInterface */
private $writer;

Expand Down
23 changes: 0 additions & 23 deletions tests/SimpleExcelReaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,27 +119,4 @@ public function it_can_use_an_alternative_delimiter()
],
], $rows);
}

/** @test */
public function the_reader_is_macroable()
{
SimpleExcelReader::macro('onlyJohns', function() {
return $this
->getRows()
->filter(function(array $row) {
return $row['first_name'] === 'john';
})
->toArray();
});

$rows = SimpleExcelReader::create($this->getStubPath('header-and-rows.csv'))->onlyJohns();

$this->assertEquals([
[
'email' => '[email protected]',
'first_name' => 'john',
'last_name' => 'doe',
],
], $rows);
}
}

0 comments on commit 789aa06

Please sign in to comment.