ZerosHandlingReaderTest.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php
  2. require_once('traits/ImportTrait.php');
  3. require_once('traits/SingleImportTestingTrait.php');
  4. use Mockery as m;
  5. class ZerosHandlingReaderTest extends TestCase {
  6. /**
  7. * Traits
  8. */
  9. use ImportTrait;
  10. /**
  11. * Filename
  12. * @var string
  13. */
  14. protected $fileName = 'files/zeros.xls';
  15. /**
  16. * @var bool
  17. */
  18. protected $noHeadings = false;
  19. public function testDefaultGet()
  20. {
  21. $got = $this->loadedFile->get();
  22. $this->assertInstanceOf('Maatwebsite\Excel\Collections\RowCollection', $got);
  23. $this->assertCount(6, $got);
  24. }
  25. //
  26. //public function testStringsAppendedPrependedWithZeros()
  27. //{
  28. // $got = $this->loadedFile->toArray();
  29. //
  30. // $this->assertContains('TEST000', $got[3]);
  31. // $this->assertContains('000TEST', $got[4]);
  32. //}
  33. //
  34. //
  35. //public function testStringZeros()
  36. //{
  37. // $got = $this->loadedFile->toArray();
  38. //
  39. // $this->assertContains('000', $got[0]);
  40. //}
  41. public function testMoney()
  42. {
  43. $got = $this->loadedFile->toArray();
  44. $this->assertContains((double) 0, $got[1]);
  45. }
  46. public function testEmptyCellHandling()
  47. {
  48. $got = $this->loadedFile->toArray();
  49. $this->assertContains(null, $got[2]);
  50. }
  51. public function testNormalZeros()
  52. {
  53. $got = $this->loadedFile->toArray();
  54. $this->assertContains((double) 0, $got[5]);
  55. }
  56. }