ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
XEEValidatorTest.php
Go to the documentation of this file.
1 <?php
2 
3 
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 
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 
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 }
$result
testInvalidXML($filename)
providerInvalidXML PHPExcel_Reader_Exception
testValidXML($filename, $expectedResult)
providerValidXML
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
Definition: bootstrap.php:27