<NME> CreateBuildCommandTest.php
<BEF> <?php

namespace Tests\PHPCensor\Command;

use PHPCensor\Command\CreateAdminCommand;
use PHPCensor\Command\CreateBuildCommand;
use PHPCensor\ConfigurationInterface;
use PHPCensor\DatabaseManager;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Psr\Log\LoggerInterface;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Tester\CommandTester;

use PHPCensor\StoreRegistry;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Tester\CommandTester;

class CreateBuildCommandTest extends TestCase
{
    private CreateBuildCommand $command;
    private Application $application;
    private ConfigurationInterface $configuration;
    private DatabaseManager $databaseManager;
    private Logger $logger;


    protected DatabaseManager $databaseManager;

    protected LoggerInterface $logger;

    protected function setUp(): void
    {
            ->setConstructorArgs([$this->configuration])
            ->getMock();
        $storeRegistry = $this
            ->getMockBuilder(StoreRegistry::class)
            ->setConstructorArgs([$this->databaseManager])
            ->getMock();

        $this->logger = $this->getMockBuilder(Logger::class)
            ->setConstructorArgs(['logger'])
            ->setConstructorArgs([$this->databaseManager])
            ->getMock();

        $this->logger          = $this->getMockBuilder('Monolog\Logger')->getMock();
        $projectMock           = $this
            ->getMockBuilder('PHPCensor\Model\Project')
            ->setConstructorArgs([$storeRegistry])
            ->getMock();
        $projectStore->method('getById')
            ->will($this->returnValueMap([
                [1, 'read', $project],
                [2, 'read', null],
            ]));

        $buildService = $this->getMockBuilder(BuildService::class)
            ->disableOriginalConstructor()
            ->getMock();

        $buildService->method('createBuild')
            ->withConsecutive(
                [$project, null, null, null, null, null],
                [$project, '92c8c6e', null, null, null, null],
                [$project, null, 'master', null, null, null]
            );

        $this->command = new CreateBuildCommand($this->configuration, $this->databaseManager, $storeRegistry, $this->logger, $projectStore, $buildService);

        $this->application = new Application();
    }

    protected function getCommandTester(): CommandTester
    {
        $this->application->add($this->command);
        $command = $this->application->find('php-censor:create-build');

        return new CommandTester($command);
    }

    public function testExecute(): void
    {
        $commandTester = $this->getCommandTester();

        $commandTester->execute(['projectId' => 1]);
        $commandTester->execute(['projectId' => 1, '--commit' => '92c8c6e']);
        $commandTester->execute(['projectId' => 1, '--branch' => 'master']);

        self::assertTrue(true);
    }

    public function testExecuteWithUnknownProjectId(): void
    {
        self::expectException(InvalidArgumentException::class);

        $commandTester = $this->getCommandTester();
        $commandTester->execute(['projectId' => 2]);
    }
}

<MSG> Fixed tests +.

<DFF> @@ -2,13 +2,13 @@
 
 namespace Tests\PHPCensor\Command;
 
+use Monolog\Logger;
 use PHPCensor\Command\CreateAdminCommand;
 use PHPCensor\Command\CreateBuildCommand;
 use PHPCensor\ConfigurationInterface;
 use PHPCensor\DatabaseManager;
 use PHPUnit\Framework\MockObject\MockObject;
 use PHPUnit\Framework\TestCase;
-use Psr\Log\LoggerInterface;
 use Symfony\Component\Console\Application;
 use Symfony\Component\Console\Tester\CommandTester;
 
@@ -28,7 +28,7 @@ class CreateBuildCommandTest extends TestCase
 
     protected DatabaseManager $databaseManager;
 
-    protected LoggerInterface $logger;
+    protected Logger $logger;
 
     protected function setUp(): void
     {
@@ -44,8 +44,10 @@ class CreateBuildCommandTest extends TestCase
             ->setConstructorArgs([$this->databaseManager])
             ->getMock();
 
-        $this->logger          = $this->getMockBuilder('Monolog\Logger')->getMock();
-        $projectMock           = $this
+        $this->logger = $this->getMockBuilder('Monolog\Logger')
+            ->setConstructorArgs(['logger'])
+            ->getMock();
+        $projectMock  = $this
             ->getMockBuilder('PHPCensor\Model\Project')
             ->setConstructorArgs([$storeRegistry])
             ->getMock();

{'addition_count': 6, 'commit_subject': 'Fixed tests +.', 'deletion_count': 4, 'file_extension': '.php', 'lang': 'php', 'license': 'bsd-2-clause', 'repo_name': 'php-censor/php-censor'}