ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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
An exception for terminatinating execution or to throw for unit testing.
testInvalidXML($filename)
@dataProvider providerInvalidXML @expectedException PHPExcel_Reader_Exception
testValidXML($filename, $expectedResult)
@dataProvider providerValidXML
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
Definition: bootstrap.php:27
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file