12345678910111213141516171819202122232425262728293031323334353637383940 |
- <?php
- namespace Maatwebsite\Excel\Tests\Concerns;
- use Maatwebsite\Excel\Concerns\Exportable;
- use Maatwebsite\Excel\Concerns\FromArray;
- use Maatwebsite\Excel\Tests\TestCase;
- class FromArrayTest extends TestCase
- {
- /**
- * @test
- */
- public function can_export_from_array()
- {
- $export = new class implements FromArray
- {
- use Exportable;
- /**
- * @return array
- */
- public function array(): array
- {
- return [
- ['test', 'test'],
- ['test', 'test'],
- ];
- }
- };
- $response = $export->store('from-array-store.xlsx');
- $this->assertTrue($response);
- $contents = $this->readAsArray(__DIR__ . '/../Data/Disks/Local/from-array-store.xlsx', 'Xlsx');
- $this->assertEquals($export->array(), $contents);
- }
- }
|