Skip to content

Commit

Permalink
Merge pull request #17 from lcobucci/add-relevant-annotations
Browse files Browse the repository at this point in the history
Add relevant annotations
  • Loading branch information
lcobucci committed Jan 19, 2018
2 parents 6c40a7c + eb1bee4 commit 9c29b04
Show file tree
Hide file tree
Showing 6 changed files with 101 additions and 6 deletions.
4 changes: 3 additions & 1 deletion lib/Doctrine/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,9 @@
@runTestsInSeparateProcesses,
@see,
@Target,
@throws
@test,
@throws,
@uses
"
/>
</properties>
Expand Down
7 changes: 4 additions & 3 deletions tests/expected_report.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ PHP CODE SNIFFER REPORT SUMMARY
FILE ERRORS WARNINGS
----------------------------------------------------------------------
tests/input/concatenation_spacing.php 24 0
tests/input/example-class.php 18 0
tests/input/example-class.php 19 0
tests/input/not_spacing.php 7 0
tests/input/return_type_on_closures.php 21 0
tests/input/return_type_on_methods.php 17 0
tests/input/test-case.php 6 0
----------------------------------------------------------------------
A TOTAL OF 87 ERRORS AND 0 WARNINGS WERE FOUND IN 5 FILES
A TOTAL OF 94 ERRORS AND 0 WARNINGS WERE FOUND IN 6 FILES
----------------------------------------------------------------------
PHPCBF CAN FIX 77 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
PHPCBF CAN FIX 83 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


6 changes: 6 additions & 0 deletions tests/fixed/example-class.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace Example;

use Doctrine\Sniffs\Spacing\ControlStructureSniff;
use Fancy\TestCase;
use const PHP_MINOR_VERSION;
use const PHP_RELEASE_VERSION as PHP_PATCH_VERSION;
use const PHP_VERSION;
Expand Down Expand Up @@ -74,4 +75,9 @@ public static function getMinorVersion() : int
{
return self::VERSION;
}

public static function getTestCase() : TestCase
{
return new TestCase();
}
}
39 changes: 39 additions & 0 deletions tests/fixed/test-case.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

declare(strict_types=1);

namespace Fancy;

use PHPUnit\Framework\TestCase;

/**
* @requires PHP 7.2
*/
final class TestCase extends TestCase
{
/**
* @beforeClass
* @afterClass
*/
public static function doStuff() : void
{
}

/**
* @before
*/
public function createDependencies() : void
{
}

/**
* @test
*
* @covers MyClass::test
*
* @uses MyClass::__construct
*/
public function methodShouldDoStuff() : void
{
}
}
10 changes: 8 additions & 2 deletions tests/input/example-class.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@

namespace Example;

use Doctrine\Sniffs\Spacing\ControlStructureSniff;
use const PHP_RELEASE_VERSION as PHP_PATCH_VERSION;
use function strlen as stringLength;
use Fancy\TestCase;
use const PHP_RELEASE_VERSION as PHP_PATCH_VERSION;
use Doctrine\Sniffs\Spacing\ControlStructureSniff;

/**
* Description
Expand Down Expand Up @@ -73,4 +74,9 @@ public static function getMinorVersion() : int
{
return self::VERSION;
}

public static function getTestCase() : TestCase
{
return new TestCase();
}
}
41 changes: 41 additions & 0 deletions tests/input/test-case.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

declare(strict_types=1);

namespace Fancy;

use PHPUnit\Framework\TestCase;

/**
* @package Quite useless
*
* @requires PHP 7.2
*/
final class TestCase extends TestCase
{
/**
* @beforeClass
* @afterClass
*/
static public function doStuff(): void
{
}

/**
* @before
*/
public function createDependencies()
{
}

/**
* @test
*
* @covers MyClass::test
*
* @uses MyClass::__construct
*/
public function methodShouldDoStuff()
{
}
}

0 comments on commit 9c29b04

Please sign in to comment.