Arbit - project tracking

PHP Depend

Browse source code

File: / tests/ PHP/ Depend/ Bugs/ DefaultNamespaceBug106Test.php

Type
text/plain text/plain
Last Author
mapi
Version
1039
Line Rev. Author Source
1 1039 mapi <?php
2 mapi /**
3 mapi * This file is part of PHP_Depend.
4 mapi *
5 mapi * PHP Version 5
6 mapi *
7 mapi * Copyright (c) 2008-2010, Manuel Pichler <mapi@pdepend.org>.
8 mapi * All rights reserved.
9 mapi *
10 mapi * Redistribution and use in source and binary forms, with or without
11 mapi * modification, are permitted provided that the following conditions
12 mapi * are met:
13 mapi *
14 mapi * * Redistributions of source code must retain the above copyright
15 mapi * notice, this list of conditions and the following disclaimer.
16 mapi *
17 mapi * * Redistributions in binary form must reproduce the above copyright
18 mapi * notice, this list of conditions and the following disclaimer in
19 mapi * the documentation and/or other materials provided with the
20 mapi * distribution.
21 mapi *
22 mapi * * Neither the name of Manuel Pichler nor the names of his
23 mapi * contributors may be used to endorse or promote products derived
24 mapi * from this software without specific prior written permission.
25 mapi *
26 mapi * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
27 mapi * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
28 mapi * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
29 mapi * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
30 mapi * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
31 mapi * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
32 mapi * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
33 mapi * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
34 mapi * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
35 mapi * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
36 mapi * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
37 mapi * POSSIBILITY OF SUCH DAMAGE.
38 mapi *
39 mapi * @category PHP
40 mapi * @package PHP_Depend
41 mapi * @subpackage Bugs
42 mapi * @author Manuel Pichler <mapi@pdepend.org>
43 mapi * @copyright 2008-2010 Manuel Pichler. All rights reserved.
44 mapi * @license http://www.opensource.org/licenses/bsd-license.php BSD License
45 mapi * @version SVN: $Id$
46 mapi * @link http://www.pdepend.org/
47 mapi */
48 mapi
49 mapi require_once dirname(__FILE__) . '/AbstractTest.php';
50 mapi
51 mapi require_once 'PHP/Depend.php';
52 mapi require_once 'PHP/Depend/Log/Summary/Xml.php';
53 mapi require_once 'PHP/Depend/Util/Type.php';
54 mapi
55 mapi /**
56 mapi * Test case for ticket #106, where internal classes appear in the metrics log
57 mapi * file.
58 mapi *
59 mapi * @category PHP
60 mapi * @package PHP_Depend
61 mapi * @subpackage Bugs
62 mapi * @author Manuel Pichler <mapi@pdepend.org>
63 mapi * @copyright 2008-2010 Manuel Pichler. All rights reserved.
64 mapi * @license http://www.opensource.org/licenses/bsd-license.php BSD License
65 mapi * @version Release: @package_version@
66 mapi * @link http://www.pdepend.org/
67 mapi */
68 mapi class PHP_Depend_Bugs_DefaultNamespaceBug106Test extends PHP_Depend_Bugs_AbstractTest
69 mapi {
70 mapi /**
71 mapi * testAllocatedInternalClassWithLeadingBackslashNotAppearsInSummaryLogFile
72 mapi *
73 mapi * @return void
74 mapi * @covers stdClass
75 mapi * @group pdepend
76 mapi * @group pdepend::bugs
77 mapi * @group regressiontest
78 mapi */
79 mapi public function testAllocatedInternalClassWithLeadingBackslashNotAppearsInSummaryLogFile()
80 mapi {
81 mapi $this->_runForTestCase(__METHOD__);
82 mapi }
83 mapi
84 mapi /**
85 mapi * testExtendedInternalClassWithLeadingBackslashNotAppearsInSummaryLogFile
86 mapi *
87 mapi * @return void
88 mapi * @covers stdClass
89 mapi * @group pdepend
90 mapi * @group pdepend::bugs
91 mapi * @group regressiontest
92 mapi */
93 mapi public function testExtendedInternalClassWithLeadingBackslashNotAppearsInSummaryLogFile()
94 mapi {
95 mapi $this->_runForTestCase(__METHOD__);
96 mapi }
97 mapi
98 mapi /**
99 mapi * Runs PHP_Depend with the summary logger, against a source file associated
100 mapi * with the given test case.
101 mapi *
102 mapi * @param string $testCase Name of the calling test case.
103 mapi *
104 mapi * @return void
105 mapi */
106 mapi private function _runForTestCase($testCase)
107 mapi {
108 mapi $uri = $this->createRunResourceURI(__FUNCTION__);
109 mapi
110 mapi $logger = new PHP_Depend_Log_Summary_Xml();
111 mapi $logger->setLogFile($uri);
112 mapi
113 mapi $pdepend = new PHP_Depend();
114 mapi $pdepend->addFile(self::getSourceFileForTestCase($testCase));
115 mapi $pdepend->addLogger($logger);
116 mapi $pdepend->analyze();
117 mapi
118 mapi $dom = new DOMDocument('1.0', 'UTF-8');
119 mapi $dom->load($uri);
120 mapi
121 mapi $xpath = new DOMXPath($dom);
122 mapi $result = $xpath->query('//class[@name="RuntimeException"]');
123 mapi
124 mapi $this->assertEquals(0, $result->length);
125 mapi }
126 mapi }