visualizer
/
vendor
/
phpoffice
/
phpexcel
/
unitTests
/
Classes
/
PHPExcel
/
Reader
/
XEEValidatorTest.php
XEEValidatorTest.php in Visualizer – Tables & Charts Manager with Built-in AI Generator 2.2.0, at vendor/phpoffice/phpexcel/unitTests/Classes/PHPExcel/Reader/XEEValidatorTest.php
| 1 | <?php |
| 2 | |
| 3 | |
| 4 | class XEEValidatorTest extends PHPUnit_Framework_TestCase |
| 5 | { |
| 6 | |
| 7 | public function setUp() |
| 8 | { |
| 9 | if (!defined('PHPEXCEL_ROOT')) { |
| 10 | define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); |
| 11 | } |
| 12 | require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); |
| 13 | } |
| 14 | |
| 15 | /** |
| 16 | * @dataProvider providerInvalidXML |
| 17 | * @expectedException PHPExcel_Reader_Exception |
| 18 | */ |
| 19 | public function testInvalidXML($filename) |
| 20 | { |
| 21 | $reader = $this->getMockForAbstractClass('PHPExcel_Reader_Abstract'); |
| 22 | $expectedResult = 'FAILURE: Should throw an Exception rather than return a value'; |
| 23 | $result = $reader->securityScanFile($filename); |
| 24 | $this->assertEquals($expectedResult, $result); |
| 25 | } |
| 26 | |
| 27 | public function providerInvalidXML() |
| 28 | { |
| 29 | $tests = []; |
| 30 | foreach(glob('rawTestData/Reader/XEETestInvalid*.xml') as $file) { |
| 31 | $tests[] = [realpath($file), true]; |
| 32 | } |
| 33 | return $tests; |
| 34 | } |
| 35 | |
| 36 | /** |
| 37 | * @dataProvider providerValidXML |
| 38 | */ |
| 39 | public function testValidXML($filename, $expectedResult) |
| 40 | { |
| 41 | $reader = $this->getMockForAbstractClass('PHPExcel_Reader_Abstract'); |
| 42 | $result = $reader->securityScanFile($filename); |
| 43 | $this->assertEquals($expectedResult, $result); |
| 44 | } |
| 45 | |
| 46 | public function providerValidXML() |
| 47 | { |
| 48 | $tests = []; |
| 49 | foreach(glob('rawTestData/Reader/XEETestValid*.xml') as $file) { |
| 50 | $tests[] = [realpath($file), file_get_contents($file)]; |
| 51 | } |
| 52 | return $tests; |
| 53 | } |
| 54 | |
| 55 | } |
| 56 |