1<?php 2 3namespace FINDOLOGIC\Export\Tests; 4 5use FINDOLOGIC\Export\Exporter; 6use PHPUnit\Framework\TestCase; 7 8class ExporterTest extends TestCase 9{ 10 public function testItemsPerPageMustBeGreaterThanZero() 11 { 12 try { 13 Exporter::create(Exporter::TYPE_XML, 0); 14 $this->fail('Requesting an item count less than one should cause an exception.'); 15 } catch (\InvalidArgumentException $e) { 16 $this->assertEquals('At least one item must be exported per page.', $e->getMessage()); 17 } 18 } 19 20 public function testUnknownExporterTypeMustThrowException() 21 { 22 try { 23 Exporter::create(123, 20); 24 $this->fail('Requesting an unknown exporter type must cause an exception.'); 25 } catch (\InvalidArgumentException $e) { 26 $this->assertEquals('Unsupported exporter type.', $e->getMessage()); 27 } 28 } 29} 30