Skip to content

Commit

Permalink
Add test for multiple limit import with heading row
Browse files Browse the repository at this point in the history
  • Loading branch information
jivanf committed Oct 31, 2024
1 parent 60d0143 commit e7e27e7
Showing 1 changed file with 36 additions and 1 deletion.
37 changes: 36 additions & 1 deletion tests/Concerns/WithLimitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public function limit(): int
$import->import('import-users.xlsx');
}

public function test_can_import_with_heading_row()
public function test_can_import_single_with_heading_row()
{
$import = new class implements ToArray, WithLimit, WithHeadingRow
{
Expand Down Expand Up @@ -136,6 +136,41 @@ public function limit(): int
$import->import('import-users-with-headings.xlsx');
}

public function test_can_import_multiple_with_heading_row()
{
$import = new class implements ToArray, WithLimit, WithHeadingRow
{
use Importable;

/**
* @param array $array
*/
public function array(array $array)
{
Assert::assertEquals([
[
'Patrick Brouwers',
'[email protected]',
],
[
'Taylor Otwell',
'[email protected]',
],
], $array);
}

/**
* @return int
*/
public function limit(): int
{
return 2;
}
};

$import->import('import-users-with-headings.xlsx');
}

public function test_can_set_limit_bigger_than_row_size()
{
$import = new class implements ToArray, WithLimit
Expand Down

0 comments on commit e7e27e7

Please sign in to comment.