Skip to content

Commit

Permalink
Improve test coverage.
Browse files Browse the repository at this point in the history
  • Loading branch information
yunosh committed Mar 6, 2017
1 parent 26dfe12 commit b89bddf
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 8 deletions.
15 changes: 10 additions & 5 deletions framework/Refactor/test/Horde/Refactor/FileLevelDocBlockTest.php
Expand Up @@ -77,25 +77,29 @@ public function testWarnings()
);
$rule->run();
$this->assertCount(12, $rule->warnings);
$this->assertEquals(
'More than one @license tag.',
$rule->warnings[0]
);
$this->assertStringStartsWith(
'The file-level DocBlock summary should be like:',
$rule->warnings[0]
$rule->warnings[1]
);
$this->assertStringStartsWith(
'The file-level DocBlock description should be like:',
$rule->warnings[1]
$rule->warnings[2]
);
foreach (array(2 => 'author', 3 => 'category', 4 => 'license', 5 => 'package') as $warning => $tag) {
foreach (array(3 => 'author', 4 => 'category', 5 => 'license', 6 => 'package') as $warning => $tag) {
$this->assertEquals(
'The file-level DocBlock tags should include: ' . $tag,
$rule->warnings[$warning]
);
}
$this->assertEquals(
'The file-level DocBlock tags should not include: copyright',
$rule->warnings[6]
$rule->warnings[7]
);
foreach (array(7 => 'author', 8 => 'category', 9 => 'copyright', 10 => 'license', 11 => 'package') as $warning => $tag) {
foreach (array(8 => 'author', 9 => 'category', 10 => 'copyright', 11 => 'package') as $warning => $tag) {
$this->assertEquals(
'The class-level DocBlock tags should include: ' . $tag,
$rule->warnings[$warning]
Expand All @@ -109,6 +113,7 @@ public function getFileNames()
array('NoFileLevelDocBlock.php', false),
array('NoFileLevelDocBlock.php', true),
array('ClassLevelDocBlock.php', false),
array('ClassLevelDocBlockWithFileLevelDocs.php', false),
);
}
}
@@ -0,0 +1,20 @@
<?php
/**
* Summary.
*
* Copyright 2001-2017 Horde LLC (http://www.horde.org/)
*
* See the enclosed file LICENSE for license information (LGPL). If you
* did not receive this file, see http://www.horde.org/licenses/lgpl.
*
* Descriptions.
*
* @author Jan Schneider <jan@horde.org>
* @category Horde
* @copyright 2017 Horde LLC
* @license http://www.horde.org/licenses/bsd BSD
* @package Foobar
*/
class Foo
{
}
Expand Up @@ -11,6 +11,9 @@
* Summary.
*
* Descriptions.
*
* @license FooBar
* @license FooBar
*/
class Foo
{
Expand Down
@@ -1,10 +1,11 @@
<?php
class Foo
class Foo extends Bar
{
/**
* Constructor.
*/
public function Foo(Bar $bar, $x = null)
{
parent::Bar($bar);
}
}
@@ -0,0 +1,27 @@
<?php
/**
* Copyright 2001-2017 Horde LLC (http://www.horde.org/)
*
* See the enclosed file LICENSE for license information (LGPL). If you
* did not receive this file, see http://www.horde.org/licenses/lgpl.
*
* @author Jan Schneider <jan@horde.org>
* @category Horde
* @license http://www.horde.org/licenses/bsd BSD
* @package Foobar
*/

/**
* Summary.
*
* Descriptions.
*
* @author Jan Schneider <jan@horde.org>
* @category Horde
* @copyright 2017 Horde LLC
* @license http://www.horde.org/licenses/bsd BSD
* @package Foobar
*/
class Foo
{
}
@@ -1,11 +1,12 @@
<?php
class Foo
class Foo extends Bar
{
/**
* Constructor.
*/
public function __construct(Bar $bar, $x = null)
{
parent::__construct($bar);
}

/**
Expand Down
8 changes: 7 additions & 1 deletion framework/Refactor/test/Horde/Refactor/phpunit.xml
@@ -1 +1,7 @@
<phpunit bootstrap="bootstrap.php"></phpunit>
<phpunit bootstrap="bootstrap.php">
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">../../../lib</directory>
</whitelist>
</filter>
</phpunit>

0 comments on commit b89bddf

Please sign in to comment.