-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add DiffConfigurator * Add TypeCaster::integer * use TypeCaster::integer * remove doc * build docs
- Loading branch information
Showing
11 changed files
with
127 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
namespace ArtARTs36\GitHandler\Config\Configurators; | ||
|
||
use ArtARTs36\GitHandler\Config\Subjects\ConfigDiff; | ||
use ArtARTs36\GitHandler\Contracts\Config\ConfigSubject; | ||
use ArtARTs36\GitHandler\Contracts\Config\SubjectConfigurator; | ||
use ArtARTs36\GitHandler\Support\TypeCaster; | ||
|
||
class DiffConfigurator implements SubjectConfigurator | ||
{ | ||
public function parse(array $raw): ConfigSubject | ||
{ | ||
return new ConfigDiff(TypeCaster::string($raw, 'external'), TypeCaster::boolean($raw['renames'])); | ||
} | ||
|
||
public function getPrefix(): string | ||
{ | ||
return 'diff'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
namespace ArtARTs36\GitHandler\Config\Subjects; | ||
|
||
use ArtARTs36\GitHandler\Attributes\ConfigKey; | ||
|
||
class ConfigDiff extends AbstractSubject | ||
{ | ||
#[ConfigKey('external')] | ||
public $externalPath; | ||
|
||
#[ConfigKey('renames')] | ||
public $renames; | ||
|
||
public function __construct(string $externalPath, bool $renames) | ||
{ | ||
$this->externalPath = $externalPath; | ||
$this->renames = $renames; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
namespace ArtARTs36\GitHandler\Tests\Unit\Config\Configurators; | ||
|
||
use ArtARTs36\GitHandler\Config\Configurators\DiffConfigurator; | ||
use ArtARTs36\GitHandler\Tests\Unit\TestCase; | ||
|
||
final class DiffConfiguratorTest extends TestCase | ||
{ | ||
public function providerForTestParse(): array | ||
{ | ||
return [ | ||
[ | ||
[ | ||
'external' => 'external_path', | ||
'renames' => 'true', | ||
], | ||
[ | ||
'externalPath' => 'external_path', | ||
'renames' => true, | ||
], | ||
], | ||
]; | ||
} | ||
|
||
/** | ||
* @dataProvider providerForTestParse | ||
* @covers \ArtARTs36\GitHandler\Config\Configurators\DiffConfigurator::parse | ||
* @covers \ArtARTs36\GitHandler\Config\Subjects\ConfigDiff::__construct | ||
*/ | ||
public function testParse(array $raw, array $expected): void | ||
{ | ||
$configurator = new DiffConfigurator(); | ||
|
||
self::assertEquals($expected, $configurator->parse($raw)->toArray()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters