-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto-review required dependency matching
- Loading branch information
1 parent
2444763
commit 4541404
Showing
4 changed files
with
94 additions
and
3 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
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,51 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* This file is part of CodeIgniter 4 framework. | ||
* | ||
* (c) CodeIgniter Foundation <[email protected]> | ||
* | ||
* For the full copyright and license information, please view | ||
* the LICENSE file that was distributed with this source code. | ||
*/ | ||
|
||
namespace CodeIgniter\AutoReview; | ||
|
||
use JsonException; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
/** | ||
* @internal | ||
* | ||
* @coversNothing | ||
* @group auto-review | ||
*/ | ||
final class ComposerJsonTest extends TestCase | ||
{ | ||
public function testFrameworkRequireIsTheSameWithDevRequire(): void | ||
{ | ||
$devComposer = $this->getComposerJson(dirname(__DIR__, 2) . '/composer.json'); | ||
$frameworkComposer = $this->getComposerJson(dirname(__DIR__, 2) . '/admin/framework/composer.json'); | ||
|
||
$this->assertSame( | ||
$devComposer['require'], | ||
$frameworkComposer['require'], | ||
'The framework\'s "require" section is not updated with the main composer.json.' | ||
); | ||
} | ||
|
||
private function getComposerJson(string $path): array | ||
{ | ||
try { | ||
return json_decode((string) file_get_contents($path), true, 512, JSON_THROW_ON_ERROR); | ||
} catch (JsonException $e) { | ||
$this->fail(sprintf( | ||
'The composer.json at "%s" is not readable or does not exist. Error was "%s".', | ||
clean_path($path), | ||
$e->getMessage() | ||
)); | ||
} | ||
} | ||
} |