diff --git a/.travis.yml b/.travis.yml index 69eda65..bd20266 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,8 @@ language: php php: - - 5.6 - - 7.0 - - 7.1 - - 7.2 + - 7.3 + - 7.4 sudo: false diff --git a/CHANGELOG.md b/CHANGELOG.md index ee52c3c..5af0bf9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,10 +7,25 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] +## [1.0.0] - 2021-05-20 +### Fixed + * [#13](https://github.com/drupal-composer/info-rewrite/pull/13): Fix tests. + * [#15](https://github.com/drupal-composer/info-rewrite/pull/15): End info files with EOL character. + * [#16](https://github.com/drupal-composer/info-rewrite/pull/16): Set core and package info. + * [#19](https://github.com/drupal-composer/info-rewrite/pull/19): Don't run rollback on missing info files. + * [#22](https://github.com/drupal-composer/info-rewrite/pull/22): Add core key only if missing core_version_requirement + +### Added + * [#17](https://github.com/drupal-composer/info-rewrite/pull/17): Additional package types. + +### Changed + * [#24](https://github.com/drupal-composer/info-rewrite/pull/24): Adjusted "Information added by line" for clarity. + ## [1.0.0 beta1] - 2018-03-01 ### Fixed * [#7](https://github.com/drupal-composer/info-rewrite/pull/7): Fatal error when no `.info` files exist. * [#10](https://github.com/drupal-composer/info-rewrite/pull/10): Drupal core had 4-digit version string. -[Unreleased]: https://github.com/drupal-composer/info-rewrite/compare/1.0.0-beta1...HEAD +[Unreleased]: https://github.com/drupal-composer/info-rewrite/compare/1.0.0...HEAD +[1.0.0]: https://github.com/drupal-composer/info-rewrite/compare/1.0.0-beta1...1.0.0 [1.0.0 beta1]: https://github.com/drupal-composer/info-rewrite/compare/1.0.0-alpha1...1.0.0-beta1 diff --git a/composer.json b/composer.json index 7a65ea3..a0495b6 100644 --- a/composer.json +++ b/composer.json @@ -20,10 +20,11 @@ }, "require-dev": { "composer/composer": "~1.0", - "jakub-onderka/php-parallel-lint": "~0.8", + "php-parallel-lint/php-parallel-lint": "^1.3", "mikey179/vfsstream": "~1.2", - "phpunit/phpunit": "~5.6", - "squizlabs/php_codesniffer": "~2.0" + "phpunit/phpunit": "^9", + "squizlabs/php_codesniffer": "^3.0", + "phpspec/prophecy-phpunit": "^2.0" }, "autoload": { "psr-4": { diff --git a/src/DrupalInfo.php b/src/DrupalInfo.php index 978c567..ad73680 100644 --- a/src/DrupalInfo.php +++ b/src/DrupalInfo.php @@ -66,7 +66,6 @@ public function activate(Composer $composer, IOInterface $io) */ public function deactivate(Composer $composer, IOInterface $io) { - } /** @@ -74,7 +73,6 @@ public function deactivate(Composer $composer, IOInterface $io) */ public function uninstall(Composer $composer, IOInterface $io) { - } /** @@ -329,5 +327,4 @@ protected function getPackageFromOperation(OperationInterface $operation) } return $package; } - } diff --git a/tests/DrupalInfoTest.php b/tests/DrupalInfoTest.php index f23c9de..78b5117 100644 --- a/tests/DrupalInfoTest.php +++ b/tests/DrupalInfoTest.php @@ -16,13 +16,16 @@ use Composer\Script\Event; use Composer\Script\ScriptEvents; use DrupalComposer\Composer\DrupalInfo; +use PHPUnit\Framework\TestCase; +use Prophecy\PhpUnit\ProphecyTrait; /** * @coversDefaultClass \DrupalComposer\Composer\DrupalInfo */ -class DrupalInfoTest extends \PHPUnit_Framework_TestCase +class DrupalInfoTest extends TestCase { use InfoFileTrait; + use ProphecyTrait; /** * @var Composer @@ -42,7 +45,7 @@ class DrupalInfoTest extends \PHPUnit_Framework_TestCase /** * {@inheritdoc} */ - protected function setUp() + protected function setUp():void { parent::setUp(); @@ -120,27 +123,13 @@ public function testInstallOperationWriteInfoFiles() foreach ($files as $file) { $this->assertFileExists($file); - $this->assertContains($info, file_get_contents($file)); + $this->assertStringContainsString($info, file_get_contents($file)); } // Verify that module with existing version information is not updated. $file = $this->getDirectory() . '/module_with_version/module_with_version.info.yml'; $this->assertFileExists($file); - $this->assertNotContains($info, file_get_contents($file)); - } - - /** - * @covers ::writeInfoFiles - */ - public function testUpdateOperationWriteInfoFiles() - { - $event = $this->prophesize(PackageEvent::class); - $operation = $this->prophesize(UpdateOperation::class); - $package = $this->prophesize(PackageInterface::class); - $package->getType()->willReturn('drupal-fo'); - $operation->getTargetPackage()->willReturn($package->reveal()); - $event->getOperation()->willReturn($operation->reveal()); - $this->fixture->writeInfoFiles($event->reveal()); + $this->assertStringNotContainsString($info, file_get_contents($file)); } /** @@ -186,20 +175,6 @@ public function testNoInfoFile() $this->fixture->writeInfoFiles($event->reveal()); } - /** - * @covers ::writeInfoFiles - */ - public function testIgnoredPackageType() - { - $event = $this->prophesize(PackageEvent::class); - $operation = $this->prophesize(InstallOperation::class); - $package = $this->prophesize(PackageInterface::class); - $package->getType()->willReturn('drupal-fo'); - $operation->getPackage()->willReturn($package->reveal()); - $event->getOperation()->willReturn($operation->reveal()); - $this->fixture->writeInfoFiles($event->reveal()); - } - /** * @covers ::rollbackRewrite */ @@ -224,7 +199,7 @@ public function testRollbackRewrite() $handle = fopen($file, 'a'); fwrite($handle, $info_pattern); fclose($handle); - $this->assertContains($info_pattern, file_get_contents($file)); + $this->assertStringContainsString($info_pattern, file_get_contents($file)); } $package = $this->prophesize(PackageInterface::class); @@ -259,7 +234,7 @@ public function testRollbackRewrite() // Verify that 3 .info files are updated. foreach ($files as $file) { $contents = file_get_contents($file); - $this->assertNotContains($info_pattern, $contents); + $this->assertStringNotContainsString($info_pattern, $contents); } } diff --git a/tests/Writer/FactoryTest.php b/tests/Writer/FactoryTest.php index b10acbf..d515981 100644 --- a/tests/Writer/FactoryTest.php +++ b/tests/Writer/FactoryTest.php @@ -6,11 +6,12 @@ use DrupalComposer\Composer\Writer\Drupal; use DrupalComposer\Composer\Writer\Drupal7; use DrupalComposer\Composer\Writer\Factory; +use PHPUnit\Framework\TestCase; /** * @coversDefaultClass \DrupalComposer\Composer\Writer\Factory */ -class FactoryTest extends \PHPUnit_Framework_TestCase +class FactoryTest extends TestCase { use InfoFileTrait;