Skip to content

Commit

Permalink
Merge pull request #600 from tienvx/use-correct-phpunit-annotation
Browse files Browse the repository at this point in the history
Replace '@Covers' by '@uses'
  • Loading branch information
tienvx committed Apr 7, 2022
2 parents c0582ce + 585f058 commit bedc146
Show file tree
Hide file tree
Showing 46 changed files with 238 additions and 176 deletions.
13 changes: 7 additions & 6 deletions composer.json
Expand Up @@ -18,16 +18,17 @@
"require": {
"php": "^8.0",
"ext-json": "*",
"doctrine/annotations": "^1.13",
"doctrine/orm": "^2.8",
"florianv/petrinet": "^2.1",
"jmgq/a-star": "^2.1",
"php-webdriver/webdriver": "^1.11",
"symfony/config": "^5.3",
"symfony/dependency-injection": "^5.3",
"symfony/expression-language": "^5.3",
"symfony/http-kernel": "^5.3",
"symfony/messenger": "^5.3",
"symfony/validator": "^5.3",
"symfony/config": "^5.4",
"symfony/dependency-injection": "^5.4",
"symfony/expression-language": "^5.4",
"symfony/http-kernel": "^5.4",
"symfony/messenger": "^5.4",
"symfony/validator": "^5.4",
"tienvx/single-color-petrinet": "^1.3"
},
"require-dev": {
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Runner/AssertionRunner.php
Expand Up @@ -221,7 +221,7 @@ public function validateTarget(CommandInterface $command): bool
protected function assert(bool $assertion, string $message): void
{
if (!$assertion) {
throw new Exception($message); //NOSONAR
throw new Exception($message);
}
}
}
2 changes: 1 addition & 1 deletion src/Command/Runner/MouseCommandRunner.php
Expand Up @@ -187,7 +187,7 @@ public function run(CommandInterface $command, ColorInterface $color, RemoteWebD
break;
}

throw new Exception( //NOSONAR
throw new Exception(
'Unable to perform mouse out as the element takes up the entire viewport'
);
case self::MOUSE_OVER:
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Runner/WindowCommandRunner.php
Expand Up @@ -106,7 +106,7 @@ protected function getDimension(string $target): WebDriverDimension
protected function getHandle(string $target): string
{
if (!$this->isValidHandle($target)) {
throw new Exception('Invalid window handle given (e.g. handle=${handleVariable})'); //NOSONAR
throw new Exception('Invalid window handle given (e.g. handle=${handleVariable})');
}

return substr($target, 7);
Expand Down
3 changes: 2 additions & 1 deletion tests/Command/CommandPreprocessorTest.php
Expand Up @@ -11,7 +11,8 @@

/**
* @covers \Tienvx\Bundle\MbtBundle\Command\CommandPreprocessor
* @covers \Tienvx\Bundle\MbtBundle\Model\Model\Revision\Command
*
* @uses \Tienvx\Bundle\MbtBundle\Model\Model\Revision\Command
*/
class CommandPreprocessorTest extends TestCase
{
Expand Down
3 changes: 2 additions & 1 deletion tests/Command/Runner/AlertCommandRunnerTest.php
Expand Up @@ -11,7 +11,8 @@
/**
* @covers \Tienvx\Bundle\MbtBundle\Command\Runner\AlertCommandRunner
* @covers \Tienvx\Bundle\MbtBundle\Command\CommandRunner
* @covers \Tienvx\Bundle\MbtBundle\Model\Model\Revision\Command
*
* @uses \Tienvx\Bundle\MbtBundle\Model\Model\Revision\Command
*/
class AlertCommandRunnerTest extends RunnerTestCase
{
Expand Down
3 changes: 2 additions & 1 deletion tests/Command/Runner/AssertionRunnerTest.php
Expand Up @@ -14,7 +14,8 @@
/**
* @covers \Tienvx\Bundle\MbtBundle\Command\Runner\AssertionRunner
* @covers \Tienvx\Bundle\MbtBundle\Command\CommandRunner
* @covers \Tienvx\Bundle\MbtBundle\Model\Model\Revision\Command
*
* @uses \Tienvx\Bundle\MbtBundle\Model\Model\Revision\Command
*/
class AssertionRunnerTest extends RunnerTestCase
{
Expand Down
3 changes: 2 additions & 1 deletion tests/Command/Runner/KeyboardCommandRunnerTest.php
Expand Up @@ -11,7 +11,8 @@
/**
* @covers \Tienvx\Bundle\MbtBundle\Command\Runner\KeyboardCommandRunner
* @covers \Tienvx\Bundle\MbtBundle\Command\CommandRunner
* @covers \Tienvx\Bundle\MbtBundle\Model\Model\Revision\Command
*
* @uses \Tienvx\Bundle\MbtBundle\Model\Model\Revision\Command
*/
class KeyboardCommandRunnerTest extends RunnerTestCase
{
Expand Down
3 changes: 2 additions & 1 deletion tests/Command/Runner/MouseCommandRunnerTest.php
Expand Up @@ -16,7 +16,8 @@
/**
* @covers \Tienvx\Bundle\MbtBundle\Command\Runner\MouseCommandRunner
* @covers \Tienvx\Bundle\MbtBundle\Command\CommandRunner
* @covers \Tienvx\Bundle\MbtBundle\Model\Model\Revision\Command
*
* @uses \Tienvx\Bundle\MbtBundle\Model\Model\Revision\Command
*/
class MouseCommandRunnerTest extends RunnerTestCase
{
Expand Down
3 changes: 2 additions & 1 deletion tests/Command/Runner/ScriptCommandRunnerTest.php
Expand Up @@ -9,7 +9,8 @@
/**
* @covers \Tienvx\Bundle\MbtBundle\Command\Runner\ScriptCommandRunner
* @covers \Tienvx\Bundle\MbtBundle\Command\CommandRunner
* @covers \Tienvx\Bundle\MbtBundle\Model\Model\Revision\Command
*
* @uses \Tienvx\Bundle\MbtBundle\Model\Model\Revision\Command
*/
class ScriptCommandRunnerTest extends RunnerTestCase
{
Expand Down
3 changes: 2 additions & 1 deletion tests/Command/Runner/StoreCommandRunnerTest.php
Expand Up @@ -11,7 +11,8 @@
/**
* @covers \Tienvx\Bundle\MbtBundle\Command\Runner\StoreCommandRunner
* @covers \Tienvx\Bundle\MbtBundle\Command\CommandRunner
* @covers \Tienvx\Bundle\MbtBundle\Model\Model\Revision\Command
*
* @uses \Tienvx\Bundle\MbtBundle\Model\Model\Revision\Command
*/
class StoreCommandRunnerTest extends RunnerTestCase
{
Expand Down
3 changes: 2 additions & 1 deletion tests/Command/Runner/WaitCommandRunnerTest.php
Expand Up @@ -15,7 +15,8 @@
/**
* @covers \Tienvx\Bundle\MbtBundle\Command\Runner\WaitCommandRunner
* @covers \Tienvx\Bundle\MbtBundle\Command\CommandRunner
* @covers \Tienvx\Bundle\MbtBundle\Model\Model\Revision\Command
*
* @uses \Tienvx\Bundle\MbtBundle\Model\Model\Revision\Command
*/
class WaitCommandRunnerTest extends RunnerTestCase
{
Expand Down
3 changes: 2 additions & 1 deletion tests/Command/Runner/WindowCommandRunnerTest.php
Expand Up @@ -17,7 +17,8 @@
/**
* @covers \Tienvx\Bundle\MbtBundle\Command\Runner\WindowCommandRunner
* @covers \Tienvx\Bundle\MbtBundle\Command\CommandRunner
* @covers \Tienvx\Bundle\MbtBundle\Model\Model\Revision\Command
*
* @uses \Tienvx\Bundle\MbtBundle\Model\Model\Revision\Command
*/
class WindowCommandRunnerTest extends RunnerTestCase
{
Expand Down
21 changes: 12 additions & 9 deletions tests/DependencyInjection/Compiler/PluginPassTest.php
Expand Up @@ -40,15 +40,18 @@ protected function setUp(): void

public function testProcessSupportedPlugins(): void
{
$this->assertSame(['plugin11'], $this->container->get(Manager1::class)->all());
$this->assertTrue($this->container->get(Manager1::class)->has('plugin11'));
$this->assertFalse($this->container->get(Manager1::class)->has('plugin12'));
$this->assertInstanceOf(Plugin11::class, $this->container->get(Manager1::class)->get('plugin11'));
$this->assertSame(['plugin21', 'plugin22'], $this->container->get(Manager2::class)->all());
$this->assertTrue($this->container->get(Manager2::class)->has('plugin21'));
$this->assertTrue($this->container->get(Manager2::class)->has('plugin22'));
$this->assertInstanceOf(Plugin21::class, $this->container->get(Manager2::class)->get('plugin21'));
$this->assertInstanceOf(Plugin22::class, $this->container->get(Manager2::class)->get('plugin22'));
$manager1 = $this->container->get(Manager1::class);
$this->assertSame(['plugin11'], $manager1->all());
$this->assertTrue($manager1->has('plugin11'));
$this->assertFalse($manager1->has('plugin12'));
$this->assertInstanceOf(Plugin11::class, $manager1->get('plugin11'));

$manager2 = $this->container->get(Manager2::class);
$this->assertSame(['plugin21', 'plugin22'], $manager2->all());
$this->assertTrue($manager2->has('plugin21'));
$this->assertTrue($manager2->has('plugin22'));
$this->assertInstanceOf(Plugin21::class, $manager2->get('plugin21'));
$this->assertInstanceOf(Plugin22::class, $manager2->get('plugin22'));
}

public function testProcessNotSupportedPlugin(): void
Expand Down
4 changes: 2 additions & 2 deletions tests/Entity/Model/RevisionTest.php
Expand Up @@ -9,8 +9,8 @@
use Tienvx\Bundle\MbtBundle\Model\ModelInterface;

/**
* @covers \Tienvx\Bundle\MbtBundle\Entity\Model
* @covers \Tienvx\Bundle\MbtBundle\Model\Model
* @uses \Tienvx\Bundle\MbtBundle\Entity\Model
* @uses \Tienvx\Bundle\MbtBundle\Model\Model
* @covers \Tienvx\Bundle\MbtBundle\Entity\Model\Revision
* @covers \Tienvx\Bundle\MbtBundle\Model\Model\Revision
*/
Expand Down
39 changes: 20 additions & 19 deletions tests/Entity/ModelTest.php
Expand Up @@ -13,27 +13,28 @@
use Tienvx\Bundle\MbtBundle\ValueObject\Model\Transition;

/**
* @covers \Tienvx\Bundle\MbtBundle\Command\CommandRunner
* @covers \Tienvx\Bundle\MbtBundle\Command\CommandRunnerManager
* @covers \Tienvx\Bundle\MbtBundle\Command\Runner\AlertCommandRunner
* @covers \Tienvx\Bundle\MbtBundle\Command\Runner\AssertionRunner
* @covers \Tienvx\Bundle\MbtBundle\Command\Runner\KeyboardCommandRunner
* @covers \Tienvx\Bundle\MbtBundle\Command\Runner\MouseCommandRunner
* @covers \Tienvx\Bundle\MbtBundle\Command\Runner\ScriptCommandRunner
* @covers \Tienvx\Bundle\MbtBundle\Command\Runner\StoreCommandRunner
* @covers \Tienvx\Bundle\MbtBundle\Command\Runner\WaitCommandRunner
* @covers \Tienvx\Bundle\MbtBundle\Command\Runner\WindowCommandRunner
* @covers \Tienvx\Bundle\MbtBundle\Validator\ValidCommandValidator
* @covers \Tienvx\Bundle\MbtBundle\Entity\Model
* @covers \Tienvx\Bundle\MbtBundle\Entity\Model\Revision
* @covers \Tienvx\Bundle\MbtBundle\Model\Model
* @covers \Tienvx\Bundle\MbtBundle\Model\Model\Revision\Command
* @covers \Tienvx\Bundle\MbtBundle\Model\Model\Revision\Place
* @covers \Tienvx\Bundle\MbtBundle\Model\Model\Revision\Transition
* @covers \Tienvx\Bundle\MbtBundle\Model\Model\Revision
* @covers \Tienvx\Bundle\MbtBundle\Validator\TagsValidator
* @covers \Tienvx\Bundle\MbtBundle\Validator\ValidCommand
* @covers \Tienvx\Bundle\MbtBundle\ValueObject\Model\Command
*
* @uses \Tienvx\Bundle\MbtBundle\Command\CommandRunner
* @uses \Tienvx\Bundle\MbtBundle\Command\CommandRunnerManager
* @uses \Tienvx\Bundle\MbtBundle\Command\Runner\AlertCommandRunner
* @uses \Tienvx\Bundle\MbtBundle\Command\Runner\AssertionRunner
* @uses \Tienvx\Bundle\MbtBundle\Command\Runner\KeyboardCommandRunner
* @uses \Tienvx\Bundle\MbtBundle\Command\Runner\MouseCommandRunner
* @uses \Tienvx\Bundle\MbtBundle\Command\Runner\ScriptCommandRunner
* @uses \Tienvx\Bundle\MbtBundle\Command\Runner\StoreCommandRunner
* @uses \Tienvx\Bundle\MbtBundle\Command\Runner\WaitCommandRunner
* @uses \Tienvx\Bundle\MbtBundle\Command\Runner\WindowCommandRunner
* @uses \Tienvx\Bundle\MbtBundle\Validator\ValidCommandValidator
* @uses \Tienvx\Bundle\MbtBundle\Entity\Model\Revision
* @uses \Tienvx\Bundle\MbtBundle\Model\Model\Revision
* @uses \Tienvx\Bundle\MbtBundle\Model\Model\Revision\Command
* @uses \Tienvx\Bundle\MbtBundle\Model\Model\Revision\Place
* @uses \Tienvx\Bundle\MbtBundle\Model\Model\Revision\Transition
* @uses \Tienvx\Bundle\MbtBundle\Validator\TagsValidator
* @uses \Tienvx\Bundle\MbtBundle\Validator\ValidCommand
* @uses \Tienvx\Bundle\MbtBundle\ValueObject\Model\Command
*/
class ModelTest extends TestCase
{
Expand Down
7 changes: 4 additions & 3 deletions tests/EventListener/EntitySubscriberTest.php
Expand Up @@ -14,9 +14,10 @@

/**
* @covers \Tienvx\Bundle\MbtBundle\EventListener\EntitySubscriber
* @covers \Tienvx\Bundle\MbtBundle\Message\ReduceBugMessage
* @covers \Tienvx\Bundle\MbtBundle\Entity\Bug
* @covers \Tienvx\Bundle\MbtBundle\Model\Bug
*
* @uses \Tienvx\Bundle\MbtBundle\Message\ReduceBugMessage
* @uses \Tienvx\Bundle\MbtBundle\Entity\Bug
* @uses \Tienvx\Bundle\MbtBundle\Model\Bug
*/
class EntitySubscriberTest extends TestCase
{
Expand Down
3 changes: 2 additions & 1 deletion tests/Factory/Model/Revision/CommandFactoryTest.php
Expand Up @@ -8,7 +8,8 @@

/**
* @covers \Tienvx\Bundle\MbtBundle\Factory\Model\Revision\CommandFactory
* @covers \Tienvx\Bundle\MbtBundle\Model\Model\Revision\Command
*
* @uses \Tienvx\Bundle\MbtBundle\Model\Model\Revision\Command
*/
class CommandFactoryTest extends TestCase
{
Expand Down
5 changes: 3 additions & 2 deletions tests/Factory/Model/Revision/PlaceFactoryTest.php
Expand Up @@ -7,8 +7,9 @@

/**
* @covers \Tienvx\Bundle\MbtBundle\Factory\Model\Revision\PlaceFactory
* @covers \Tienvx\Bundle\MbtBundle\Model\Model\HasCommands
* @covers \Tienvx\Bundle\MbtBundle\Model\Model\Revision\Place
*
* @uses \Tienvx\Bundle\MbtBundle\Model\Model\HasCommands
* @uses \Tienvx\Bundle\MbtBundle\Model\Model\Revision\Place
*/
class PlaceFactoryTest extends TestCase
{
Expand Down
5 changes: 3 additions & 2 deletions tests/Factory/Model/Revision/TransitionFactoryTest.php
Expand Up @@ -7,8 +7,9 @@

/**
* @covers \Tienvx\Bundle\MbtBundle\Factory\Model\Revision\TransitionFactory
* @covers \Tienvx\Bundle\MbtBundle\Model\Model\HasCommands
* @covers \Tienvx\Bundle\MbtBundle\Model\Model\Revision\Transition
*
* @uses \Tienvx\Bundle\MbtBundle\Model\Model\HasCommands
* @uses \Tienvx\Bundle\MbtBundle\Model\Model\Revision\Transition
*/
class TransitionFactoryTest extends TestCase
{
Expand Down
13 changes: 7 additions & 6 deletions tests/Factory/Model/RevisionFactoryTest.php
Expand Up @@ -6,13 +6,14 @@
use Tienvx\Bundle\MbtBundle\Factory\Model\RevisionFactory;

/**
* @covers \Tienvx\Bundle\MbtBundle\Factory\Model\Revision\PlaceFactory
* @covers \Tienvx\Bundle\MbtBundle\Factory\Model\Revision\TransitionFactory
* @covers \Tienvx\Bundle\MbtBundle\Factory\Model\RevisionFactory
* @covers \Tienvx\Bundle\MbtBundle\Model\Model\HasCommands
* @covers \Tienvx\Bundle\MbtBundle\Model\Model\Revision\Place
* @covers \Tienvx\Bundle\MbtBundle\Model\Model\Revision\Transition
* @covers \Tienvx\Bundle\MbtBundle\Model\Model\Revision
*
* @uses \Tienvx\Bundle\MbtBundle\Factory\Model\Revision\PlaceFactory
* @uses \Tienvx\Bundle\MbtBundle\Factory\Model\Revision\TransitionFactory
* @uses \Tienvx\Bundle\MbtBundle\Model\Model\HasCommands
* @uses \Tienvx\Bundle\MbtBundle\Model\Model\Revision\Place
* @uses \Tienvx\Bundle\MbtBundle\Model\Model\Revision\Transition
* @uses \Tienvx\Bundle\MbtBundle\Model\Model\Revision
*/
class RevisionFactoryTest extends TestCase
{
Expand Down
9 changes: 5 additions & 4 deletions tests/Factory/ModelFactoryTest.php
Expand Up @@ -8,10 +8,11 @@

/**
* @covers \Tienvx\Bundle\MbtBundle\Factory\ModelFactory
* @covers \Tienvx\Bundle\MbtBundle\Factory\Model\RevisionFactory
* @covers \Tienvx\Bundle\MbtBundle\Entity\Model
* @covers \Tienvx\Bundle\MbtBundle\Model\Model
* @covers \Tienvx\Bundle\MbtBundle\Model\Model\Revision
*
* @uses \Tienvx\Bundle\MbtBundle\Factory\Model\RevisionFactory
* @uses \Tienvx\Bundle\MbtBundle\Entity\Model
* @uses \Tienvx\Bundle\MbtBundle\Model\Model
* @uses \Tienvx\Bundle\MbtBundle\Model\Model\Revision
*/
class ModelFactoryTest extends TestCase
{
Expand Down
48 changes: 34 additions & 14 deletions tests/Generator/RandomGeneratorTest.php
Expand Up @@ -9,6 +9,7 @@
use Tienvx\Bundle\MbtBundle\Entity\Task;
use Tienvx\Bundle\MbtBundle\Generator\GeneratorManager;
use Tienvx\Bundle\MbtBundle\Generator\RandomGenerator;
use Tienvx\Bundle\MbtBundle\Model\Bug\StepInterface;
use Tienvx\Bundle\MbtBundle\Model\TaskInterface;
use Tienvx\Bundle\MbtBundle\Service\ExpressionLanguage;
use Tienvx\Bundle\MbtBundle\Service\Model\ModelHelper;
Expand All @@ -20,19 +21,20 @@
/**
* @covers \Tienvx\Bundle\MbtBundle\Generator\RandomGenerator
* @covers \Tienvx\Bundle\MbtBundle\Generator\AbstractGenerator
* @covers \Tienvx\Bundle\MbtBundle\Model\Generator\State
* @covers \Tienvx\Bundle\MbtBundle\Model\Bug\Step
* @covers \Tienvx\Bundle\MbtBundle\Entity\Task
* @covers \Tienvx\Bundle\MbtBundle\Model\Task
* @covers \Tienvx\Bundle\MbtBundle\Entity\Model
* @covers \Tienvx\Bundle\MbtBundle\Model\Model
* @covers \Tienvx\Bundle\MbtBundle\Model\Model\Revision\Place
* @covers \Tienvx\Bundle\MbtBundle\Model\Model\Revision\Transition
* @covers \Tienvx\Bundle\MbtBundle\Model\Model\Revision
* @covers \Tienvx\Bundle\MbtBundle\Service\ExpressionLanguage
* @covers \Tienvx\Bundle\MbtBundle\Service\Petrinet\MarkingHelper
* @covers \Tienvx\Bundle\MbtBundle\Service\Petrinet\PetrinetHelper
* @covers \Tienvx\Bundle\MbtBundle\Service\Model\ModelHelper
*
* @uses \Tienvx\Bundle\MbtBundle\Model\Generator\State
* @uses \Tienvx\Bundle\MbtBundle\Model\Bug\Step
* @uses \Tienvx\Bundle\MbtBundle\Entity\Task
* @uses \Tienvx\Bundle\MbtBundle\Model\Task
* @uses \Tienvx\Bundle\MbtBundle\Entity\Model
* @uses \Tienvx\Bundle\MbtBundle\Model\Model
* @uses \Tienvx\Bundle\MbtBundle\Model\Model\Revision\Place
* @uses \Tienvx\Bundle\MbtBundle\Model\Model\Revision\Transition
* @uses \Tienvx\Bundle\MbtBundle\Model\Model\Revision
* @uses \Tienvx\Bundle\MbtBundle\Service\ExpressionLanguage
* @uses \Tienvx\Bundle\MbtBundle\Service\Petrinet\MarkingHelper
* @uses \Tienvx\Bundle\MbtBundle\Service\Petrinet\PetrinetHelper
* @uses \Tienvx\Bundle\MbtBundle\Service\Model\ModelHelper
*/
class RandomGeneratorTest extends TestCase
{
Expand Down Expand Up @@ -86,8 +88,26 @@ public function testGetName(): void
$this->assertSame('random', RandomGenerator::getName());
}

public function testIsSupported(): void
{
$this->assertTrue(RandomGenerator::isSupported());
}

public function testGenerate(): void
{
$this->assertCount(3, $this->generator->generate($this->task));
$count = 0;
$steps = [
['transition' => 0, 'places' => [0 => 1], 'color' => []],
['transition' => 1, 'places' => [1 => 1], 'color' => []],
['transition' => 2, 'places' => [2 => 1], 'color' => []],
];
foreach ($this->generator->generate($this->task) as $index => $step) {
$this->assertInstanceOf(StepInterface::class, $step);
$this->assertSame($steps[$index]['transition'], $step->getTransition());
$this->assertSame($steps[$index]['places'], $step->getPlaces());
$this->assertSame($steps[$index]['color'], $step->getColor()->getValues());
++$count;
}
$this->assertSame(3, $count);
}
}
3 changes: 2 additions & 1 deletion tests/MessageHandler/RecordVideoMessageHandlerTest.php
Expand Up @@ -9,7 +9,8 @@

/**
* @covers \Tienvx\Bundle\MbtBundle\MessageHandler\RecordVideoMessageHandler
* @covers \Tienvx\Bundle\MbtBundle\Message\RecordVideoMessage
*
* @uses \Tienvx\Bundle\MbtBundle\Message\RecordVideoMessage
*/
class RecordVideoMessageHandlerTest extends TestCase
{
Expand Down

0 comments on commit bedc146

Please sign in to comment.