ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
CodePageTest.php
Go to the documentation of this file.
1<?php
2
3
4require_once 'testDataFileIterator.php';
5
7{
8
9 public function setUp()
10 {
11 if (!defined('PHPEXCEL_ROOT')) {
12 define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
13 }
14 require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
15 }
16
20 public function testCodePageNumberToName()
21 {
22 $args = func_get_args();
23 $expectedResult = array_pop($args);
24 $result = call_user_func_array(array('PHPExcel_Shared_CodePage','NumberToName'),$args);
25 $this->assertEquals($expectedResult, $result);
26 }
27
28 public function providerCodePage()
29 {
30 return new testDataFileIterator('rawTestData/Shared/CodePage.data');
31 }
32
34 {
35 $invalidCodePage = 12345;
36 try {
37 $result = call_user_func(array('PHPExcel_Shared_CodePage','NumberToName'),$invalidCodePage);
38 } catch (Exception $e) {
39 $this->assertEquals($e->getMessage(), 'Unknown codepage: 12345');
40 return;
41 }
42 $this->fail('An expected exception has not been raised.');
43 }
44
46 {
47 $unsupportedCodePage = 720;
48 try {
49 $result = call_user_func(array('PHPExcel_Shared_CodePage','NumberToName'),$unsupportedCodePage);
50 } catch (Exception $e) {
51 $this->assertEquals($e->getMessage(), 'Code page 720 not supported.');
52 return;
53 }
54 $this->fail('An expected exception has not been raised.');
55 }
56
57}
$result
An exception for terminatinating execution or to throw for unit testing.
testNumberToNameWithInvalidCodePage()
testCodePageNumberToName()
@dataProvider providerCodePage
testNumberToNameWithUnsupportedCodePage()
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
Definition: bootstrap.php:27