annotate cake/tests/cases/libs/code_coverage_manager.test.php @ 0:261e66bd5a0c

hg init
author Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
date Sun, 24 Jul 2011 21:08:31 +0900
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 <?php
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 /**
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 * CodeCoverageManagerTest file
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 *
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 * PHP versions 4 and 5
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 *
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 * CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 * Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 *
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 * Licensed under The Open Group Test Suite License
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 * Redistributions of files must retain the above copyright notice.
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 *
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 * @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 * @package cake
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 * @subpackage cake.tests.cases.libs
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 * @since CakePHP(tm) v 1.2.0.4206
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 * @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 */
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
20 require_once CAKE . 'tests' . DS . 'lib' . DS . 'code_coverage_manager.php';
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 require_once CAKE . 'tests' . DS . 'lib' . DS . 'reporter' . DS . 'cake_cli_reporter.php';
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
22
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 /**
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
24 * CodeCoverageManagerTest class
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 *
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 * @package cake
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
27 * @subpackage cake.tests.cases.libs
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
28 */
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
29 class CodeCoverageManagerTest extends CakeTestCase {
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
30
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
31 /**
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
32 * Skip if XDebug not installed
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
33 *
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
34 * @access public
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
35 */
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
36 function skip() {
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
37 $this->skipIf(!extension_loaded('xdebug'), '%s XDebug not installed');
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
38 }
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
39
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
40 /**
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
41 * startTest Method
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
42 * Store reference of $_GET to restore later.
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
43 *
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
44 * @return void
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
45 */
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
46 function startCase() {
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
47 $this->_get = $_GET;
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
48 }
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
49
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
50 /**
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
51 * End Case - restore GET vars.
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
52 *
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
53 * @return void
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
54 */
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
55 function endCase() {
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
56 $_GET = $this->_get;
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
57 }
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
58
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
59 /**
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
60 * testNoTestCaseSupplied method
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
61 *
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
62 * @access public
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
63 * @return void
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
64 */
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
65 function testNoTestCaseSupplied() {
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
66 if ($this->skipIf(PHP_SAPI == 'cli', 'Is cli, cannot run this test %s')) {
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
67 return;
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
68 }
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
69 $reporter =& new CakeHtmlReporter(null, array('group' => false, 'app' => false, 'plugin' => false));
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
70
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
71 CodeCoverageManager::init(substr(md5(microtime()), 0, 5), $reporter);
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
72 CodeCoverageManager::report(false);
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
73 $this->assertError();
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
74
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
75 CodeCoverageManager::init('tests' . DS . 'lib' . DS . basename(__FILE__), $reporter);
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
76 CodeCoverageManager::report(false);
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
77 $this->assertError();
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
78 }
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
79
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
80 /**
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
81 * Test that test cases don't cause errors
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
82 *
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
83 * @return void
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
84 */
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
85 function testNoTestCaseSuppliedNoErrors() {
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
86 if ($this->skipIf(PHP_SAPI == 'cli', 'Is cli, cannot run this test %s')) {
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
87 return;
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
88 }
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
89 $reporter =& new CakeHtmlReporter(null, array('group' => false, 'app' => false, 'plugin' => false));
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
90 $path = LIBS;
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
91 if (strpos(LIBS, ROOT) === false) {
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
92 $path = ROOT.DS.LIBS;
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
93 }
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
94 App::import('Core', 'Folder');
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
95 $folder = new Folder();
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
96 $folder->cd($path);
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
97 $contents = $folder->read();
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
98
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
99 $contents[1] = array_filter($contents[1], array(&$this, '_basenameFilter'));
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
100
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
101 foreach ($contents[1] as $file) {
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
102 CodeCoverageManager::init('libs' . DS . $file, $reporter);
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
103 CodeCoverageManager::report(false);
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
104 $this->assertNoErrors('libs' . DS . $file);
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
105 }
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
106 }
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
107
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
108 /**
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
109 * Remove file names that don't share a basename with the current file.
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
110 *
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
111 * @return void
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
112 */
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
113 function _basenameFilter($var) {
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
114 return ($var != basename(__FILE__));
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
115 }
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
116
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
117 /**
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
118 * testGetTestObjectFileNameFromTestCaseFile method
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
119 *
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
120 * @access public
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
121 * @return void
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
122 */
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
123 function testGetTestObjectFileNameFromTestCaseFile() {
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
124 $manager =& CodeCoverageManager::getInstance();
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
125 $manager->reporter = new CakeHtmlReporter();
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
126
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
127 $expected = $manager->__testObjectFileFromCaseFile('models/some_file.test.php', true);
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
128 $this->assertIdentical(APP.'models'.DS.'some_file.php', $expected);
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
129
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
130 $expected = $manager->__testObjectFileFromCaseFile('models/datasources/some_file.test.php', true);
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
131 $this->assertIdentical(APP.'models'.DS.'datasources'.DS.'some_file.php', $expected);
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
132
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
133 $expected = $manager->__testObjectFileFromCaseFile('controllers/some_file.test.php', true);
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
134 $this->assertIdentical(APP.'controllers'.DS.'some_file.php', $expected);
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
135
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
136 $expected = $manager->__testObjectFileFromCaseFile('views/some_file.test.php', true);
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
137 $this->assertIdentical(APP.'views'.DS.'some_file.php', $expected);
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
138
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
139 $expected = $manager->__testObjectFileFromCaseFile('behaviors/some_file.test.php', true);
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
140 $this->assertIdentical(APP.'models'.DS.'behaviors'.DS.'some_file.php', $expected);
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
141
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
142 $expected = $manager->__testObjectFileFromCaseFile('components/some_file.test.php', true);
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
143 $this->assertIdentical(APP.'controllers'.DS.'components'.DS.'some_file.php', $expected);
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
144
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
145 $expected = $manager->__testObjectFileFromCaseFile('helpers/some_file.test.php', true);
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
146 $this->assertIdentical(APP.'views'.DS.'helpers'.DS.'some_file.php', $expected);
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
147
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
148 $manager->pluginTest = 'bugs';
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
149 $expected = $manager->__testObjectFileFromCaseFile('models/some_file.test.php', false);
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
150 $this->assertIdentical(APP.'plugins'.DS.'bugs'.DS.'models'.DS.'some_file.php', $expected);
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
151
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
152 $manager->pluginTest = false;
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
153 $manager->reporter = new CakeCliReporter;
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
154 $expected = $manager->__testObjectFileFromCaseFile('libs/set.test.php', false);
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
155 $this->assertIdentical(ROOT.DS.'cake'.DS.'libs'.DS.'set.php', $expected);
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
156 }
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
157
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
158 /**
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
159 * testOfHtmlDiffReport method
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
160 *
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
161 * @access public
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
162 * @return void
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
163 */
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
164 function testOfHtmlDiffReport() {
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
165 $manager =& CodeCoverageManager::getInstance();
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
166 $code = <<<PHP
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
167 /**
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
168 * Set class
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
169 *
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
170 * @package cake
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
171 * @subpackage cake.tests.cases.libs
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
172 */
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
173 class Set extends Object {
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
174
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
175 /**
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
176 * Value of the Set object.
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
177 *
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
178 * @var array
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
179 * @access public
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
180 */
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
181 var \$value = array();
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
182
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
183 /**
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
184 * Constructor. Defaults to an empty array.
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
185 *
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
186 * @access public
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
187 */
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
188 function __construct() {
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
189 if (func_num_args() == 1 && is_array(func_get_arg(0))) {
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
190 \$this->value = func_get_arg(0);
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
191 } else {
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
192 \$this->value = func_get_args();
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
193 }
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
194 }
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
195
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
196 /**
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
197 * Returns the contents of the Set object
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
198 *
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
199 * @return array
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
200 * @access public
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
201 */
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
202 function &get() {
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
203 return \$this->value;
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
204 }
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
205
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
206 /**
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
207 * This function can be thought of as a hybrid between PHP's array_merge and array_merge_recursive. The difference
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
208 * to the two is that if an array key contains another array then the function behaves recursive (unlike array_merge)
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
209 * but does not do if for keys containing strings (unlike array_merge_recursive). See the unit test for more information.
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
210 *
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
211 * Note: This function will work with an unlimited amount of arguments and typecasts non-array parameters into arrays.
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
212 *
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
213 * @param array \$arr1 Array to be merged
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
214 * @param array \$arr2 Array to merge with
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
215 * @return array Merged array
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
216 * @access public
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
217 */
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
218 function merge(\$arr1, \$arr2 = null) {
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
219 \$args = func_get_args();
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
220
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
221 if (isset(\$this) && is_a(\$this, 'set')) {
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
222 \$backtrace = debug_backtrace();
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
223 \$previousCall = strtolower(\$backtrace[1]['class'].'::'.\$backtrace[1]['function']);
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
224 if (\$previousCall != 'set::merge') {
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
225 \$r =& \$this->value;
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
226 array_unshift(\$args, null);
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
227 }
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
228 }
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
229 if (!isset(\$r)) {
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
230 \$r = (array)current(\$args);
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
231 }
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
232
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
233 while ((\$arg = next(\$args)) !== false) {
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
234 if (is_a(\$arg, 'set')) {
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
235 \$arg = \$arg->get();
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
236 }
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
237
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
238 foreach ((array)\$arg as \$key => \$val) {
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
239 if (is_array(\$val) && isset(\$r[\$key]) && is_array(\$r[\$key])) {
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
240 \$r[\$key] = Set::merge(\$r[\$key], \$val);
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
241 } elseif (is_int(\$key)) {
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
242
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
243 } else {
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
244 \$r[\$key] = \$val;
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
245 }
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
246 }
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
247 }
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
248 return \$r;
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
249 }
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
250 PHP;
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
251
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
252 $testObjectFile = explode("\n", $code);
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
253 $coverageData = array(
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
254 0 => 1,
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
255 1 => 1,
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
256 2 => -2,
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
257 3 => -2,
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
258 4 => -2,
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
259 5 => -2,
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
260 6 => -2,
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
261 7 => -2,
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
262 8 => -1,
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
263 9 => -2,
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
264 10 => -2,
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
265 11 => -2,
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
266 12 => -2,
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
267 13 => -2,
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
268 14 => 1,
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
269 15 => 1,
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
270 16 => -1,
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
271 17 => 1,
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
272 18 => 1,
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
273 19 => -1,
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
274 20 => 1,
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
275 21 => -2,
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
276 22 => -2,
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
277 23 => -2,
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
278 24 => -2,
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
279 25 => -2,
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
280 26 => -2,
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
281 27 => 1,
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
282 28 => -1,
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
283 29 => 1,
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
284 30 => 1,
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
285 31 => -2,
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
286 32 => -2,
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
287 33 => -2,
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
288 34 => -2,
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
289 35 => -2,
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
290 36 => -2,
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
291 37 => -2,
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
292 38 => -2,
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
293 39 => -2,
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
294 40 => -2,
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
295 41 => -2,
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
296 42 => -2,
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
297 43 => -1,
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
298 44 => -2,
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
299 45 => -2,
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
300 46 => -2,
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
301 47 => -2,
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
302 48 => 1,
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
303 49 => 1,
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
304 50 => -1,
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
305 51 => 1,
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
306 52 => 1,
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
307 53 => -2,
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
308 54 => -2,
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
309 55 => 1,
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
310 56 => 1,
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
311 57 => 1,
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
312 58 => 1,
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
313 59 => -1,
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
314 60 => 1,
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
315 61 => 1,
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
316 62 => -2,
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
317 63 => -2,
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
318 64 => 1,
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
319 65 => -2,
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
320 66 => 1,
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
321 67 => -1,
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
322 68 => -2,
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
323 69 => -1,
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
324 70 => -1,
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
325 71 => 1,
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
326 72 => -2,
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
327 );
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
328 $expected = array(
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
329 0 => 'ignored',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
330 1 => 'ignored',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
331 2 => 'ignored',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
332 3 => 'ignored',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
333 4 => 'ignored',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
334 5 => 'ignored show start realstart',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
335 6 => 'ignored show',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
336 7 => 'ignored show',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
337 8 => 'uncovered show',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
338 9 => 'ignored show',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
339 10 => 'ignored show',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
340 11 => 'ignored show end',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
341 12 => 'ignored',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
342 13 => 'ignored show start',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
343 14 => 'covered show',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
344 15 => 'covered show',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
345 16 => 'uncovered show',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
346 17 => 'covered show show',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
347 18 => 'covered show show',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
348 19 => 'uncovered show',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
349 20 => 'covered show',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
350 21 => 'ignored show',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
351 22 => 'ignored show end',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
352 23 => 'ignored',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
353 24 => 'ignored',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
354 25 => 'ignored show start',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
355 26 => 'ignored show',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
356 27 => 'covered show',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
357 28 => 'uncovered show',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
358 29 => 'covered show',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
359 30 => 'covered show',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
360 31 => 'ignored show end',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
361 32 => 'ignored',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
362 33 => 'ignored',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
363 34 => 'ignored',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
364 35 => 'ignored',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
365 36 => 'ignored',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
366 37 => 'ignored',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
367 38 => 'ignored',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
368 39 => 'ignored',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
369 40 => 'ignored show start',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
370 41 => 'ignored show',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
371 42 => 'ignored show',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
372 43 => 'uncovered show',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
373 41 => 'ignored show',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
374 42 => 'ignored show',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
375 43 => 'uncovered show',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
376 44 => 'ignored show',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
377 45 => 'ignored show',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
378 46 => 'ignored show',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
379 47 => 'ignored show',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
380 48 => 'covered show',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
381 49 => 'covered show',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
382 50 => 'uncovered show',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
383 51 => 'covered show',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
384 52 => 'covered show',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
385 53 => 'ignored show end',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
386 54 => 'ignored',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
387 55 => 'covered',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
388 56 => 'covered show start',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
389 57 => 'covered show',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
390 58 => 'covered show',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
391 59 => 'uncovered show',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
392 60 => 'covered show',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
393 61 => 'covered show',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
394 62 => 'ignored show end',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
395 63 => 'ignored',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
396 64 => 'covered show start',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
397 65 => 'ignored show',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
398 66 => 'covered show show',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
399 67 => 'uncovered show',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
400 68 => 'ignored show',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
401 69 => 'uncovered show',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
402 70 => 'uncovered show',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
403 71 => 'covered show',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
404 72 => 'ignored show',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
405 73 => 'ignored show end end',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
406 );
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
407 $execCodeLines = range(0, 72);
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
408 $result = explode("</div>", $report = $manager->reportCaseHtmlDiff($testObjectFile, $coverageData, $execCodeLines, 3));
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
409
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
410 foreach ($result as $line) {
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
411 preg_match('/<span class="line-num">(.*?)<\/span>/', $line, $matches);
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
412 if (!isset($matches[1])) {
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
413 continue;
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
414 }
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
415
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
416 $num = $matches[1];
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
417 $class = $expected[$num];
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
418 $pattern = '/<div class="code-line '.$class.'">/';
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
419 $this->assertPattern($pattern, $line, $num.': '.$line." fails");
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
420 }
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
421 }
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
422
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
423 /**
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
424 * testArrayStrrpos method
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
425 *
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
426 * @access public
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
427 * @return void
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
428 */
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
429 function testArrayStrrpos() {
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
430 $manager =& CodeCoverageManager::getInstance();
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
431
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
432 $a = array(
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
433 'apples',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
434 'bananas',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
435 'oranges'
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
436 );
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
437 $this->assertEqual(1, $manager->__array_strpos($a, 'ba', true));
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
438 $this->assertEqual(2, $manager->__array_strpos($a, 'range', true));
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
439 $this->assertEqual(0, $manager->__array_strpos($a, 'pp', true));
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
440 $this->assertFalse($manager->__array_strpos('', 'ba', true));
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
441 $this->assertFalse($manager->__array_strpos(false, 'ba', true));
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
442 $this->assertFalse($manager->__array_strpos(array(), 'ba', true));
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
443
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
444 $a = array(
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
445 'rang',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
446 'orange',
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
447 'oranges'
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
448 );
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
449 $this->assertEqual(0, $manager->__array_strpos($a, 'rang'));
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
450 $this->assertEqual(2, $manager->__array_strpos($a, 'rang', true));
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
451 $this->assertEqual(1, $manager->__array_strpos($a, 'orange', false));
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
452 $this->assertEqual(1, $manager->__array_strpos($a, 'orange'));
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
453 $this->assertEqual(2, $manager->__array_strpos($a, 'orange', true));
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
454 }
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
455
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
456 /**
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
457 * testGetExecutableLines method
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
458 *
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
459 * @access public
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
460 * @return void
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
461 */
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
462 function testGetExecutableLines() {
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
463 $manager =& CodeCoverageManager::getInstance();
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
464 $code = <<<HTML
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
465 \$manager =& CodeCoverageManager::getInstance();
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
466 HTML;
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
467 $result = $manager->__getExecutableLines($code);
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
468 foreach ($result as $line) {
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
469 $this->assertNotIdentical($line, '');
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
470 }
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
471
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
472 $code = <<<HTML
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
473 {
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
474 }
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
475 <?php?>
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
476 ?>
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
477 <?
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
478 }
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
479 {{}}
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
480 (())
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
481 @codeCoverageIgnoreStart
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
482 some
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
483 more
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
484 code
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
485 here
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
486 @codeCoverageIgnoreEnd
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
487 HTML;
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
488 $result = $manager->__getExecutableLines($code);
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
489 foreach ($result as $line) {
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
490 $this->assertIdentical(trim($line), '');
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
491 }
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
492 }
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
493
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
494 /**
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
495 * testCalculateCodeCoverage method
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
496 *
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
497 * @access public
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
498 * @return void
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
499 */
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
500 function testCalculateCodeCoverage() {
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
501 $manager =& CodeCoverageManager::getInstance();
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
502 $data = array(
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
503 '25' => array(100, 25),
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
504 '50' => array(100, 50),
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
505 '0' => array(0, 0),
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
506 '0' => array(100, 0),
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
507 '100' => array(100, 100),
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
508 );
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
509 foreach ($data as $coverage => $lines) {
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
510 $this->assertEqual($coverage, $manager->__calcCoverage($lines[0], $lines[1]));
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
511 }
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
512
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
513 $manager->__calcCoverage(100, 1000);
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
514 $this->assertError();
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
515 }
261e66bd5a0c hg init
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
516 }