InvalidFileTest.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. namespace PhpOffice\PhpSpreadsheetTests\Reader\Ods;
  3. use PhpOffice\PhpSpreadsheet\Reader\Exception as ReaderException;
  4. use PhpOffice\PhpSpreadsheet\Reader\Ods;
  5. use PHPUnit\Framework\TestCase;
  6. class InvalidFileTest extends TestCase
  7. {
  8. public function testInvalidFileLoad(): void
  9. {
  10. $this->expectException(ReaderException::class);
  11. $this->expectExceptionMessage('Could not find zip member');
  12. $temp = __FILE__;
  13. $reader = new Ods();
  14. $reader->load($temp);
  15. }
  16. public function testInvalidFileNames(): void
  17. {
  18. $this->expectException(ReaderException::class);
  19. $this->expectExceptionMessage('Could not find zip member');
  20. $temp = __FILE__;
  21. $reader = new Ods();
  22. $reader->listWorksheetNames($temp);
  23. }
  24. public function testInvalidInfo(): void
  25. {
  26. $this->expectException(ReaderException::class);
  27. $this->expectExceptionMessage('Could not find zip member');
  28. $temp = __FILE__;
  29. $reader = new Ods();
  30. $reader->listWorksheetInfo($temp);
  31. }
  32. public function testXlsxFileLoad(): void
  33. {
  34. $this->expectException(ReaderException::class);
  35. $this->expectExceptionMessage('Could not find zip member');
  36. $temp = 'samples/templates/26template.xlsx';
  37. $reader = new Ods();
  38. $reader->load($temp);
  39. }
  40. public function testXlsxFileNames(): void
  41. {
  42. $this->expectException(ReaderException::class);
  43. $this->expectExceptionMessage('Could not find zip member');
  44. $temp = 'samples/templates/26template.xlsx';
  45. $reader = new Ods();
  46. $reader->listWorksheetNames($temp);
  47. }
  48. public function testXlsxInfo(): void
  49. {
  50. $this->expectException(ReaderException::class);
  51. $this->expectExceptionMessage('Could not find zip member');
  52. $temp = 'samples/templates/26template.xlsx';
  53. $reader = new Ods();
  54. $reader->listWorksheetInfo($temp);
  55. }
  56. }