Skip to content

Commit

Permalink
refactor (Tools/Execution)
Browse files Browse the repository at this point in the history
  • Loading branch information
Wtyd committed Oct 13, 2022
1 parent d2cabf9 commit 4742247
Show file tree
Hide file tree
Showing 18 changed files with 36 additions and 25 deletions.
4 changes: 2 additions & 2 deletions src/Container/RegisterBindings.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
namespace Wtyd\GitHooks\Container;

use Illuminate\Container\Container;
use Wtyd\GitHooks\Tools\Execution\ProcessExecutionFactory;
use Wtyd\GitHooks\Tools\Execution\ProcessExecutionFactoryAbstract;
use Wtyd\GitHooks\Tools\Process\ProcessExecutionFactory\ProcessExecutionFactory;
use Wtyd\GitHooks\Tools\Process\ProcessExecutionFactory\ProcessExecutionFactoryAbstract;
use Wtyd\GitHooks\Utils\FileUtils;
use Wtyd\GitHooks\Utils\FileUtilsInterface;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

declare(strict_types=1);

namespace Wtyd\GitHooks\Tools\Execution;
namespace Wtyd\GitHooks\Tools\Process\Execution;

use Symfony\Component\Process\Exception\ProcessTimedOutException;
use Wtyd\GitHooks\Tools\Errors;
use Wtyd\GitHooks\Tools\Process\Process;

class MultiProcessesExecution extends ProcessExecutionAbstract
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

declare(strict_types=1);

namespace Wtyd\GitHooks\Tools\Execution;
namespace Wtyd\GitHooks\Tools\Process\Execution;

use Wtyd\GitHooks\Tools\Process\ExecutionFakeTrait;

class MultiProcessesExecutionFake extends MultiProcessesExecution
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Wtyd\GitHooks\Tools\Execution;
namespace Wtyd\GitHooks\Tools\Process\Execution;

use Wtyd\GitHooks\Tools\Errors;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

declare(strict_types=1);

namespace Wtyd\GitHooks\Tools\Execution;
namespace Wtyd\GitHooks\Tools\Process\Execution;

use Wtyd\GitHooks\Tools\Errors;
use Wtyd\GitHooks\Tools\Process\Process;
use Wtyd\GitHooks\Tools\Tool\ToolAbstract;
use Wtyd\GitHooks\Utils\Printer;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

declare(strict_types=1);

namespace Wtyd\GitHooks\Tools\Execution;
namespace Wtyd\GitHooks\Tools\Process\Execution;

use Wtyd\GitHooks\Tools\Process\ExecutionFakeTrait;

class ProcessExecutionFake extends ProcessExecution
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Wtyd\GitHooks\Tools\Execution;
namespace Wtyd\GitHooks\Tools\Process;

/**
* Trait for testing purposes. Gives public visibility for some methods and properties.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Wtyd\GitHooks\Tools\Execution;
namespace Wtyd\GitHooks\Tools\Process;

use Symfony\Component\Process\Exception\LogicException;
use Symfony\Component\Process\Process as SymfonyProcess;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@

declare(strict_types=1);

namespace Wtyd\GitHooks\Tools\Execution;
namespace Wtyd\GitHooks\Tools\Process\ProcessExecutionFactory;

use Wtyd\GitHooks\Tools\Process\Execution\MultiProcessesExecution;
use Wtyd\GitHooks\Tools\Process\Execution\ProcessExecution;
use Wtyd\GitHooks\Tools\Process\Execution\ProcessExecutionAbstract;
use Wtyd\GitHooks\Tools\Tool\ToolAbstract;

class ProcessExecutionFactory extends ProcessExecutionFactoryAbstract
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

declare(strict_types=1);

namespace Wtyd\GitHooks\Tools\Execution;
namespace Wtyd\GitHooks\Tools\Process\ProcessExecutionFactory;

use Illuminate\Contracts\Container\Container;
use Wtyd\GitHooks\Tools\Process\Execution\ProcessExecutionAbstract;
use Wtyd\GitHooks\Utils\Printer;

abstract class ProcessExecutionFactoryAbstract
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@

declare(strict_types=1);

namespace Wtyd\GitHooks\Tools\Execution;
namespace Wtyd\GitHooks\Tools\Process\ProcessExecutionFactory;

use Wtyd\GitHooks\Tools\Process\Execution\MultiProcessesExecutionFake;
use Wtyd\GitHooks\Tools\Process\Execution\ProcessExecutionAbstract;
use Wtyd\GitHooks\Tools\Process\Execution\ProcessExecutionFake;
use Wtyd\GitHooks\Tools\Tool\ToolAbstract;

class ProcessExecutionFactoryFake extends ProcessExecutionFactoryAbstract
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Wtyd\GitHooks\Tools\Execution;
namespace Wtyd\GitHooks\Tools\Process;

use Wtyd\GitHooks\Tools\Tool\ToolAbstract;

Expand Down Expand Up @@ -83,7 +83,7 @@ public function isSuccessful(): bool
* Only in MultiProcessExecution when the execution fails
* @inheritDoc
*/
public function getOutput()
public function getOutput(): string
{
return $this->output;
}
Expand All @@ -92,7 +92,7 @@ public function getOutput()
* Only in ProcessExecution
* @inheritDoc
*/
public function wait(callable $callback = null)
public function wait(callable $callback = null): int
{
return $this->isSuccessful ? 0 : 1;
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Integration/IgnoreErrorsOnExitFlagTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

use Tests\Utils\TestCase\ConsoleTestCase;
use Wtyd\GitHooks\ConfigurationFile\FileReader;
use Wtyd\GitHooks\Tools\Execution\MultiProcessesExecutionFake;
use Wtyd\GitHooks\Tools\Execution\ProcessExecutionFake;
use Wtyd\GitHooks\Tools\Process\Execution\MultiProcessesExecutionFake;
use Wtyd\GitHooks\Tools\Process\Execution\ProcessExecutionFake;

class IgnoreErrorsOnExitFlagTest extends ConsoleTestCase
{
Expand Down
4 changes: 2 additions & 2 deletions tests/System/Commands/ExecuteToolCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
use Tests\Utils\FileUtilsFake;
use Tests\Utils\PhpFileBuilder;
use Tests\Utils\TestCase\SystemTestCase;
use Wtyd\GitHooks\Tools\Execution\MultiProcessesExecutionFake;
use Wtyd\GitHooks\Tools\Execution\ProcessExecutionFake;
use Wtyd\GitHooks\Tools\Process\Execution\MultiProcessesExecutionFake;
use Wtyd\GitHooks\Tools\Process\Execution\ProcessExecutionFake;
use Wtyd\GitHooks\Utils\FileUtils;
use Wtyd\GitHooks\Utils\FileUtilsInterface;

Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Tools/Execution/MultiProcessesExecutionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use Tests\Utils\ConfigurationFileBuilder;
use Tests\Utils\TestCase\UnitTestCase;
use Wtyd\GitHooks\ConfigurationFile\ConfigurationFile;
use Wtyd\GitHooks\Tools\Execution\MultiProcessesExecutionFake;
use Wtyd\GitHooks\Tools\Process\Execution\MultiProcessesExecutionFake;
use Wtyd\GitHooks\Tools\ToolsFactoy;
use Wtyd\GitHooks\Utils\Printer;

Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Tools/Execution/ProcessExecutionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use Tests\Utils\ConfigurationFileBuilder;
use Tests\Utils\TestCase\UnitTestCase;
use Wtyd\GitHooks\ConfigurationFile\ConfigurationFile;
use Wtyd\GitHooks\Tools\Execution\ProcessExecutionFake;
use Wtyd\GitHooks\Tools\Process\Execution\ProcessExecutionFake;
use Wtyd\GitHooks\Tools\ToolsFactoy;
use Wtyd\GitHooks\Utils\Printer;

Expand Down
4 changes: 2 additions & 2 deletions tests/Utils/TestCase/ConsoleTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
ZeroTestCase,
PendingCommand
};
use Wtyd\GitHooks\Tools\Execution\ProcessExecutionFactoryAbstract;
use Wtyd\GitHooks\Tools\Execution\ProcessExecutionFactoryFake;
use Wtyd\GitHooks\Tools\Process\ProcessExecutionFactory\ProcessExecutionFactoryAbstract;
use Wtyd\GitHooks\Tools\Process\ProcessExecutionFactory\ProcessExecutionFactoryFake;
use Wtyd\GitHooks\Tools\Tool\{
CodeSniffer\Phpcbf,
CodeSniffer\PhpcbfFake,
Expand Down
2 changes: 0 additions & 2 deletions tests/Utils/TestCase/SystemTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
use Tests\Utils\ConfigurationFileBuilder;
use Tests\Utils\FileUtilsFake;
use Tests\Utils\Traits\FileSystemTrait;
use Wtyd\GitHooks\Tools\Execution\ProcessExecutionFactoryAbstract;
use Wtyd\GitHooks\Tools\Execution\ProcessExecutionFactoryFake;
use Wtyd\GitHooks\Utils\FileUtilsInterface;

abstract class SystemTestCase extends ConsoleTestCase
Expand Down

0 comments on commit 4742247

Please sign in to comment.