Arbit - project tracking

PHPMD

History

Diff

201 202 /test/PHP/PMD/Regression/ExcessivePublicCountRuleNeverExecutedTicket015Test.php
2 +<?php
3 +/**
4 + * This file is part of PHP_PMD.
5 + *
6 + * PHP Version 5
7 + *
8 + * Copyright (c) 2009-2010, Manuel Pichler <mapi@phpmd.org>.
9 + * All rights reserved.
10 + *
11 + * Redistribution and use in source and binary forms, with or without
12 + * modification, are permitted provided that the following conditions
13 + * are met:
14 + *
15 + * * Redistributions of source code must retain the above copyright
16 + * notice, this list of conditions and the following disclaimer.
17 + *
18 + * * Redistributions in binary form must reproduce the above copyright
19 + * notice, this list of conditions and the following disclaimer in
20 + * the documentation and/or other materials provided with the
21 + * distribution.
22 + *
23 + * * Neither the name of Manuel Pichler nor the names of his
24 + * contributors may be used to endorse or promote products derived
25 + * from this software without specific prior written permission.
26 + *
27 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
28 + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
29 + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
30 + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
31 + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
32 + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
33 + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
34 + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
35 + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
36 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
37 + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
38 + * POSSIBILITY OF SUCH DAMAGE.
39 + *
40 + * @category PHP
41 + * @package PHP_PMD
42 + * @subpackage Regression
43 + * @author Manuel Pichler <mapi@phpmd.org>
44 + * @copyright 2009-2010 Manuel Pichler. All rights reserved.
45 + * @license http://www.opensource.org/licenses/bsd-license.php BSD License
46 + * @version SVN: $Id$
47 + * @link http://phpmd.org
48 + */
49 +
50 +require_once dirname(__FILE__) . '/AbstractTest.php';
51 +
52 +require_once 'PHP/PMD/RuleSet.php';
53 +require_once 'PHP/PMD/Rule/ExcessivePublicCount.php';
54 +
55 +/**
56 + * Regression test for issue 015.
57 + *
58 + * @category PHP
59 + * @package PHP_PMD
60 + * @subpackage Regression
61 + * @author Manuel Pichler <mapi@phpmd.org>
62 + * @copyright 2009-2010 Manuel Pichler. All rights reserved.
63 + * @license http://www.opensource.org/licenses/bsd-license.php BSD License
64 + * @version Release: @package_version@
65 + * @link http://phpmd.org
66 + */
67 +class PHP_PMD_Regression_ExcessivePublicCountRuleNeverExecutedTicket015Test
68 + extends PHP_PMD_Regression_AbstractTest
69 +{
70 + /**
71 + * testRuleSetInvokesRuleForClassInstance
72 + *
73 + * @return void
74 + * @covers stdClass
75 + * @group phpmd
76 + * @group regression
77 + */
78 + public function testRuleSetInvokesRuleForClassInstance()
79 + {
80 + $rule = new PHP_PMD_Rule_ExcessivePublicCount();
81 + $rule->addProperty('minimum', 3);
82 +
83 + $class = $this->getClass();
84 + $class->setMetrics(array('cis' => 4));
85 +
86 + $ruleSet = new PHP_PMD_RuleSet();
87 + $ruleSet->addRule($rule);
88 + $ruleSet->setReport($this->getReportMock(1));
89 +
90 + $ruleSet->apply($class);
91 + }
92 +}
201 202 /test/PHP/PMD/_files/Regression/015/testRuleSetInvokesRuleForClassInstance.php
2 +<?php
3 +class testRuleSetInvokesRuleForClassInstance
4 +{
5 + public $a, $b, $c, $d;
6 +}