-
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
25cdddc
commit e5bce6b
Showing
32 changed files
with
1,148 additions
and
860 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
58 changes: 58 additions & 0 deletions
58
test/Integration/Command/NormalizeCommand/Json/NotValid/Test.php
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,58 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* Copyright (c) 2018-2020 Andreas Möller | ||
* | ||
* For the full copyright and license information, please view | ||
* the LICENSE.md file that was distributed with this source code. | ||
* | ||
* @see https://github.com/ergebnis/composer-normalize | ||
*/ | ||
|
||
namespace Ergebnis\Composer\Normalize\Test\Integration\Command\NormalizeCommand\Json\NotValid; | ||
|
||
use Ergebnis\Composer\Normalize\Test\Integration; | ||
use Ergebnis\Composer\Normalize\Test\Util; | ||
use Symfony\Component\Console; | ||
|
||
/** | ||
* @internal | ||
* | ||
* @covers \Ergebnis\Composer\Normalize\Command\NormalizeCommand | ||
* @covers \Ergebnis\Composer\Normalize\NormalizePlugin | ||
*/ | ||
final class Test extends Integration\Command\NormalizeCommand\AbstractTestCase | ||
{ | ||
/** | ||
* @dataProvider \Ergebnis\Composer\Normalize\Test\DataProvider\Command\NormalizeCommandProvider::commandInvocation() | ||
*/ | ||
public function testFailsWhenComposerJsonIsValidAccordingToLaxValidation(Util\CommandInvocation $commandInvocation): void | ||
{ | ||
$scenario = self::createScenario( | ||
$commandInvocation, | ||
__DIR__ . '/files' | ||
); | ||
|
||
$initialState = $scenario->initialState(); | ||
|
||
self::assertComposerJsonFileExists($initialState); | ||
self::assertComposerLockFileNotExists($initialState); | ||
|
||
$application = self::createApplicationWithNormalizeCommandAsProvidedByNormalizePlugin(); | ||
|
||
$output = new Console\Output\BufferedOutput(); | ||
|
||
$input = new Console\Input\ArrayInput($scenario->consoleParameters()); | ||
|
||
$exitCode = $application->run( | ||
$input, | ||
$output | ||
); | ||
|
||
self::assertExitCodeSame(1, $exitCode); | ||
self::assertStringContainsString('does not match the expected JSON schema', $output->fetch()); | ||
self::assertEquals($initialState, $scenario->currentState()); | ||
} | ||
} |
File renamed without changes.
64 changes: 64 additions & 0 deletions
64
...ation/Command/NormalizeCommand/Json/Valid/Lock/NotPresent/Json/AlreadyNormalized/Test.php
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,64 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* Copyright (c) 2018-2020 Andreas Möller | ||
* | ||
* For the full copyright and license information, please view | ||
* the LICENSE.md file that was distributed with this source code. | ||
* | ||
* @see https://github.com/ergebnis/composer-normalize | ||
*/ | ||
|
||
namespace Ergebnis\Composer\Normalize\Test\Integration\Command\NormalizeCommand\Json\Valid\Lock\NotPresent\Json\AlreadyNormalized; | ||
|
||
use Ergebnis\Composer\Normalize\Test\Integration; | ||
use Ergebnis\Composer\Normalize\Test\Util; | ||
use Symfony\Component\Console; | ||
|
||
/** | ||
* @internal | ||
* | ||
* @covers \Ergebnis\Composer\Normalize\Command\NormalizeCommand | ||
* @covers \Ergebnis\Composer\Normalize\NormalizePlugin | ||
*/ | ||
final class Test extends Integration\Command\NormalizeCommand\AbstractTestCase | ||
{ | ||
/** | ||
* @dataProvider \Ergebnis\Composer\Normalize\Test\DataProvider\Command\NormalizeCommandProvider::commandInvocation() | ||
*/ | ||
public function testSucceeds(Util\CommandInvocation $commandInvocation): void | ||
{ | ||
$scenario = self::createScenario( | ||
$commandInvocation, | ||
__DIR__ . '/files' | ||
); | ||
|
||
$initialState = $scenario->initialState(); | ||
|
||
self::assertComposerJsonFileExists($initialState); | ||
self::assertComposerLockFileNotExists($initialState); | ||
|
||
$application = self::createApplicationWithNormalizeCommandAsProvidedByNormalizePlugin(); | ||
|
||
$output = new Console\Output\BufferedOutput(); | ||
|
||
$input = new Console\Input\ArrayInput($scenario->consoleParameters()); | ||
|
||
$exitCode = $application->run( | ||
$input, | ||
$output | ||
); | ||
|
||
self::assertExitCodeSame(0, $exitCode); | ||
|
||
$expected = \sprintf( | ||
'%s is already normalized.', | ||
$scenario->composerJsonFileReference() | ||
); | ||
|
||
self::assertStringContainsString($expected, $output->fetch()); | ||
self::assertEquals($initialState, $scenario->currentState()); | ||
} | ||
} |
File renamed without changes.
Oops, something went wrong.