Skip to content

Commit

Permalink
Removed json-assert.
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexSkrypnyk committed May 26, 2024
1 parent a49ced0 commit 027ec39
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 92 deletions.
17 changes: 8 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,14 @@
"dealerdirect/phpcodesniffer-composer-installer": "^1.0",
"drupal/coder": "^8.3",
"ergebnis/composer-normalize": "^2.42",
"helmich/phpunit-json-assert": "^3.5.2",
"phpcompatibility/php-compatibility": "^9.3",
"phpmd/phpmd": "^2.15",
"phpstan/phpstan": "^1.10",
"phpunit/phpunit": "^11.1",
"rector/rector": "^1.0"
},
"minimum-stability": "dev",
"prefer-stable": true,
"autoload": {
"psr-4": {
"AlexSkrypnyk\\Customizer\\": ""
Expand All @@ -49,15 +50,16 @@
},
"sort-packages": true
},
"minimum-stability": "dev",
"prefer-stable": true,
"extra": {
"class": "AlexSkrypnyk\\Customizer\\Plugin"
},
"scripts": {
"customize": [
"AlexSkrypnyk\\Customizer\\CustomizeCommand"
],
"post-create-project-cmd": [
"@customize"
],
"customize": [
"AlexSkrypnyk\\Customizer\\CustomizeCommand"
],
"lint": [
"phpcs",
"phpmd --exclude vendor . text phpmd.xml",
Expand All @@ -70,8 +72,5 @@
],
"test": "phpunit --no-coverage",
"test-coverage": "phpunit"
},
"extra": {
"class": "AlexSkrypnyk\\Customizer\\Plugin"
}
}
62 changes: 31 additions & 31 deletions tests/phpunit/Functional/CreateProjectCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,13 @@ public function testCommandNoInstall(): void {
$this->assertDirectoryDoesNotExist('vendor');

$json = $this->composerJsonRead('composer.json');
$this->assertJsonValueEquals($json, 'name', 'testorg/testpackage');
$this->assertJsonValueEquals($json, 'description', 'Test description');
$this->assertJsonValueEquals($json, 'license', 'MIT');
$this->assertJsonHasNoKey($json, 'scripts');
$this->assertEquals('testorg/testpackage', $json['name']);
$this->assertEquals('Test description', $json['description']);
$this->assertEquals('MIT', $json['license']);
$this->assertArrayNotHasKey('scripts', $json);

$this->assertJsonHasNoKey($json, 'autoload');
$this->assertJsonHasNoKey($json, 'scripts');
$this->assertArrayNotHasKey('autoload', $json);
$this->assertArrayNotHasKey('scripts', $json);
$this->assertFileDoesNotExist($this->customizerFile);
}

Expand Down Expand Up @@ -114,12 +114,12 @@ public function testCommandNoInstallCommandInDifferentDir(): void {
$this->assertDirectoryDoesNotExist('vendor');

$json = $this->composerJsonRead('composer.json');
$this->assertJsonValueEquals($json, 'name', 'testorg/testpackage');
$this->assertJsonValueEquals($json, 'description', 'Test description');
$this->assertJsonValueEquals($json, 'license', 'MIT');
$this->assertEquals('testorg/testpackage', $json['name']);
$this->assertEquals('Test description', $json['description']);
$this->assertEquals('MIT', $json['license']);

$this->assertJsonHasNoKey($json, 'autoload');
$this->assertJsonHasNoKey($json, 'scripts');
$this->assertArrayNotHasKey('autoload', $json);
$this->assertArrayNotHasKey('scripts', $json);
$this->assertFileDoesNotExist($this->customizerFile);
}

Expand All @@ -142,12 +142,12 @@ public function testCommandNoInstallNoConfigFile(): void {
$this->assertDirectoryDoesNotExist('vendor');

$json = $this->composerJsonRead('composer.json');
$this->assertJsonValueEquals($json, 'name', 'yourorg/yourtempaltepackage');
$this->assertJsonValueEquals($json, 'description', 'Your template package description');
$this->assertJsonHasNoKey($json, 'license');
$this->assertEquals('yourorg/yourtempaltepackage', $json['name']);
$this->assertEquals('Your template package description', $json['description']);
$this->assertArrayNotHasKey('license', $json);

$this->assertJsonHasKey($json, 'autoload');
$this->assertJsonHasKey($json, 'scripts');
$this->assertArrayHasKey('autoload', $json);
$this->assertArrayHasKey('scripts', $json);
$this->assertFileExists($this->customizerFile);
}

Expand All @@ -171,12 +171,12 @@ public function testCommandNoInstallCancel(): void {
$this->assertDirectoryDoesNotExist('vendor');

$json = $this->composerJsonRead('composer.json');
$this->assertJsonValueEquals($json, 'name', 'yourorg/yourtempaltepackage');
$this->assertJsonValueEquals($json, 'description', 'Your template package description');
$this->assertJsonHasNoKey($json, 'license');
$this->assertEquals('yourorg/yourtempaltepackage', $json['name']);
$this->assertEquals('Your template package description', $json['description']);
$this->assertArrayNotHasKey('license', $json);

$this->assertJsonHasKey($json, 'autoload');
$this->assertJsonHasKey($json, 'scripts');
$this->assertArrayHasKey('autoload', $json);
$this->assertArrayHasKey('scripts', $json);
$this->assertFileExists($this->customizerFile);
}

Expand All @@ -201,12 +201,12 @@ public function testCommandInstall(): void {
$this->assertDirectoryExists('vendor/monolog/monolog');

$json = $this->composerJsonRead('composer.json');
$this->assertJsonValueEquals($json, 'name', 'testorg/testpackage');
$this->assertJsonValueEquals($json, 'description', 'Test description');
$this->assertJsonValueEquals($json, 'license', 'MIT');
$this->assertEquals('testorg/testpackage', $json['name']);
$this->assertEquals('Test description', $json['description']);
$this->assertEquals('MIT', $json['license']);

$this->assertJsonHasNoKey($json, 'autoload');
$this->assertJsonHasNoKey($json, 'scripts');
$this->assertArrayNotHasKey('autoload', $json);
$this->assertArrayNotHasKey('scripts', $json);
$this->assertFileDoesNotExist($this->customizerFile);

$this->assertComposerLockUpToDate();
Expand All @@ -232,12 +232,12 @@ public function testCommandInstallCancel(): void {
$this->assertDirectoryExists('vendor/monolog/monolog');

$json = $this->composerJsonRead('composer.json');
$this->assertJsonValueEquals($json, 'name', 'yourorg/yourtempaltepackage');
$this->assertJsonValueEquals($json, 'description', 'Your template package description');
$this->assertJsonHasNoKey($json, 'license');
$this->assertEquals('yourorg/yourtempaltepackage', $json['name']);
$this->assertEquals('Your template package description', $json['description']);
$this->assertArrayNotHasKey('license', $json);

$this->assertJsonHasKey($json, 'autoload');
$this->assertJsonHasKey($json, 'scripts');
$this->assertArrayHasKey('autoload', $json);
$this->assertArrayHasKey('scripts', $json);
$this->assertFileExists($this->customizerFile);
}

Expand Down
18 changes: 8 additions & 10 deletions tests/phpunit/Functional/CreateProjectPluginTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ public function testPluginInstall(): void {
$this->assertDirectoryDoesNotExist('vendor/alexskrypnyk/customizer');

$json = $this->composerJsonRead('composer.json');
$this->assertJsonValueEquals($json, 'name', 'testorg/testpackage');
$this->assertJsonValueEquals($json, 'description', 'Test description');
$this->assertJsonValueEquals($json, 'license', 'MIT');
$this->assertEquals('testorg/testpackage', $json['name']);
$this->assertEquals('Test description', $json['description']);
$this->assertEquals('MIT', $json['license']);

$this->assertJsonHasNoKey($json, 'require-dev');
$this->assertJsonHasNoKey($json, 'config.allow-plugins');
$this->assertArrayNotHasKey('require-dev', $json);
$this->assertArrayNotHasKey('allow-plugins', $json['config']);
$this->assertFileDoesNotExist($this->customizerFile);

$this->assertComposerLockUpToDate();
Expand All @@ -73,13 +73,11 @@ public function testPluginInstallNoConfigFile(): void {
$this->assertDirectoryExists('vendor/alexskrypnyk/customizer');

$json = $this->composerJsonRead('composer.json');
$this->assertJsonValueEquals($json, 'name', 'yourorg/yourtempaltepackage');
$this->assertJsonValueEquals($json, 'description', 'Your template package description');
$this->assertJsonValueEquals($json, 'license', 'proprietary');
$this->assertEquals('yourorg/yourtempaltepackage', $json['name']);
$this->assertEquals('Your template package description', $json['description']);
$this->assertEquals('proprietary', $json['license']);

$this->assertJsonHasKey($json, 'require-dev');
$this->assertArrayHasKey('alexskrypnyk/customizer', $json['require-dev']);
$this->assertJsonHasKey($json, 'config.allow-plugins');
$this->assertArrayHasKey('alexskrypnyk/customizer', $json['config']['allow-plugins']);
$this->assertFileDoesNotExist($this->customizerFile);

Expand Down
3 changes: 0 additions & 3 deletions tests/phpunit/Functional/CustomizerTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
use AlexSkrypnyk\Customizer\Tests\Traits\CmdTrait;
use AlexSkrypnyk\Customizer\Tests\Traits\ComposerTrait;
use AlexSkrypnyk\Customizer\Tests\Traits\DirsTrait;
use AlexSkrypnyk\Customizer\Tests\Traits\JsonAssertTrait;
use Helmich\JsonAssert\JsonAssertions;
use PHPUnit\Framework\TestCase;
use PHPUnit\Framework\TestStatus\Error;
Expand All @@ -22,8 +21,6 @@ class CustomizerTestCase extends TestCase {

use ComposerTrait;
use DirsTrait;
use JsonAssertions;
use JsonAssertTrait;
use CmdTrait;

/**
Expand Down
39 changes: 0 additions & 39 deletions tests/phpunit/Traits/JsonAssertTrait.php

This file was deleted.

0 comments on commit 027ec39

Please sign in to comment.