ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
HyperlinkTest.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 {
11 define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
12 }
13 require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
14 }
15
16 public function testGetUrl()
17 {
18 $urlValue = 'http://www.phpexcel.net';
19
20 $testInstance = new PHPExcel_Cell_Hyperlink($urlValue);
21
22 $result = $testInstance->getUrl();
23 $this->assertEquals($urlValue,$result);
24 }
25
26 public function testSetUrl()
27 {
28 $initialUrlValue = 'http://www.phpexcel.net';
29 $newUrlValue = 'http://github.com/PHPOffice/PHPExcel';
30
31 $testInstance = new PHPExcel_Cell_Hyperlink($initialUrlValue);
32 $result = $testInstance->setUrl($newUrlValue);
33 $this->assertTrue($result instanceof PHPExcel_Cell_Hyperlink);
34
35 $result = $testInstance->getUrl();
36 $this->assertEquals($newUrlValue,$result);
37 }
38
39 public function testGetTooltip()
40 {
41 $tooltipValue = 'PHPExcel Web Site';
42
43 $testInstance = new PHPExcel_Cell_Hyperlink(NULL, $tooltipValue);
44
45 $result = $testInstance->getTooltip();
46 $this->assertEquals($tooltipValue,$result);
47 }
48
49 public function testSetTooltip()
50 {
51 $initialTooltipValue = 'PHPExcel Web Site';
52 $newTooltipValue = 'PHPExcel Repository on Github';
53
54 $testInstance = new PHPExcel_Cell_Hyperlink(NULL, $initialTooltipValue);
55 $result = $testInstance->setTooltip($newTooltipValue);
56 $this->assertTrue($result instanceof PHPExcel_Cell_Hyperlink);
57
58 $result = $testInstance->getTooltip();
59 $this->assertEquals($newTooltipValue,$result);
60 }
61
62 public function testIsInternal()
63 {
64 $initialUrlValue = 'http://www.phpexcel.net';
65 $newUrlValue = 'sheet://Worksheet1!A1';
66
67 $testInstance = new PHPExcel_Cell_Hyperlink($initialUrlValue);
68 $result = $testInstance->isInternal();
69 $this->assertFalse($result);
70
71 $testInstance->setUrl($newUrlValue);
72 $result = $testInstance->isInternal();
73 $this->assertTrue($result);
74 }
75
76 public function testGetHashCode()
77 {
78 $urlValue = 'http://www.phpexcel.net';
79 $tooltipValue = 'PHPExcel Web Site';
80 $initialExpectedHash = 'd84d713aed1dbbc8a7c5af183d6c7dbb';
81
82 $testInstance = new PHPExcel_Cell_Hyperlink($urlValue, $tooltipValue);
83
84 $result = $testInstance->getHashCode();
85 $this->assertEquals($initialExpectedHash,$result);
86 }
87
88}
$result
An exception for terminatinating execution or to throw for unit testing.
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
Definition: bootstrap.php:27