Skip to content

Commit

Permalink
Use grep instead php search
Browse files Browse the repository at this point in the history
  • Loading branch information
Wiktor6 committed Oct 18, 2023
1 parent 751747e commit 50706e5
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 46 deletions.
28 changes: 28 additions & 0 deletions tests/Unit/CodeAnalysisTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

declare(strict_types=1);

namespace Answear\FanCourierBundle\Tests\Unit;

use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;

class CodeAnalysisTest extends TestCase
{
#[Test]
public function testNoAnnotationTest(): void
{
$directory = __DIR__ . '/../';

exec("grep -rl --exclude='CodeAnalysisTest.php' '$directory' -e '@test\|@dataProvider'", $output, $returnCode);

if (!empty($output)) {
$message = 'Found the @test or @dataProvider annotation in the following files. Use attributes instead:' . PHP_EOL;
$message .= implode(PHP_EOL, $output);
} else {
$message = 'No @test or @dataProvider annotations found in any other file.';
}

$this->assertSame(1, $returnCode, $message);
}
}
46 changes: 0 additions & 46 deletions tests/Unit/UseTestAttributeTest.php

This file was deleted.

0 comments on commit 50706e5

Please sign in to comment.