Skip to content

Commit

Permalink
Merge pull request #238 from acelaya-forks/feature/phpunit-12
Browse files Browse the repository at this point in the history
Update to PHPUnit 12
  • Loading branch information
acelaya authored Feb 13, 2025
2 parents ce8ec93 + 21f6081 commit 7a77320
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 11 deletions.
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,23 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com), and this project adheres to [Semantic Versioning](https://semver.org).

## [Unreleased]
### Added
* *Nothing*

### Changed
* Update to PHPUnit 12

### Deprecated
* *Nothing*

### Removed
* Drop support for shlink-config 3.0

### Fixed
* *Nothing*


## [9.5.0] - 2025-01-25
### Added
* Support shlink-config 4.0
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@
"laminas/laminas-config-aggregator": "^1.17",
"laminas/laminas-servicemanager": "^4.3 || ^3.23",
"laminas/laminas-stdlib": "^3.20",
"shlinkio/shlink-config": "^4.0 || ^3.4",
"shlinkio/shlink-config": "^4.0",
"symfony/console": "^7.2",
"symfony/filesystem": "^7.2",
"symfony/process": "^7.2",
"webimpress/safe-writer": "^2.2"
},
"require-dev": {
"devster/ubench": "^2.1",
"phpstan/phpstan": "^2.0",
"phpstan/phpstan": "^2.1",
"phpstan/phpstan-phpunit": "^2.0",
"phpunit/phpunit": "^11.5",
"phpunit/phpunit": "^12.0",
"roave/security-advisories": "dev-master",
"shlinkio/php-coding-standard": "~2.4.0",
"symfony/var-dumper": "^7.2"
Expand Down
2 changes: 1 addition & 1 deletion test/Command/InstallCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function commandIsExecutedAsExpected(): void
)->willReturn(0);
$this->assetsHandler->expects($this->never())->method('resolvePreviousConfig');
$this->assetsHandler->expects($this->never())->method('importShlinkAssetsFromPath');
$this->configWriter->expects($this->once())->method('toFile')->with($this->anything(), $this->isType('array'));
$this->configWriter->expects($this->once())->method('toFile')->with($this->anything(), $this->isArray());

$this->commandTester->setInputs(['no']);
$this->commandTester->execute([]);
Expand Down
6 changes: 3 additions & 3 deletions test/Command/SetOptionCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ protected function tearDown(): void
#[Test]
public function exceptionIsThrownWhenGeneratedConfigFileDoesNotExist(): void
{
$this->filesystem->expects($this->once())->method('exists')->with($this->isType('string'))->willReturn(false);
$this->filesystem->expects($this->once())->method('exists')->with($this->isString())->willReturn(false);
$this->configWriter->expects($this->never())->method('toFile');
$this->assetsHandler->expects($this->never())->method('dropCachedConfigIfAny');
$this->optionsManager->expects($this->never())->method('get');
Expand All @@ -77,7 +77,7 @@ public function exceptionIsThrownWhenGeneratedConfigFileDoesNotExist(): void
#[Test]
public function expectedOptionsAreOfferedBasedOnConfig(): void
{
$this->filesystem->expects($this->once())->method('exists')->with($this->isType('string'))->willReturn(true);
$this->filesystem->expects($this->once())->method('exists')->with($this->isString())->willReturn(true);
$this->configWriter->expects($this->once())->method('toFile');
$this->assetsHandler->expects($this->once())->method('dropCachedConfigIfAny')->with(
$this->isInstanceOf(SymfonyStyle::class),
Expand All @@ -86,7 +86,7 @@ public function expectedOptionsAreOfferedBasedOnConfig(): void
$plugin = $this->createMock(ConfigOptionInterface::class);
$plugin->expects($this->once())->method('ask')->willReturn('');
$plugin->expects($this->once())->method('getEnvVar')->willReturn('foo');
$this->optionsManager->expects($this->once())->method('get')->with($this->isType('string'))->willReturn(
$this->optionsManager->expects($this->once())->method('get')->with($this->isString())->willReturn(
$plugin,
);

Expand Down
2 changes: 1 addition & 1 deletion test/Command/UpdateCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function commandIsExecutedAsExpected(bool $rrBinExists, string $postUpdat
ImportedConfig::notImported(),
);
$this->assetsHandler->expects($this->once())->method('importShlinkAssetsFromPath');
$this->configWriter->expects($this->once())->method('toFile')->with($this->anything(), $this->isType('array'));
$this->configWriter->expects($this->once())->method('toFile')->with($this->anything(), $this->isArray());

$this->commandTester->setInputs(['no']);
$this->commandTester->execute([]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function expectedQuestionIsAsked(string $choice, int $expectedAnswer): vo
$io = $this->createMock(StyleInterface::class);
$io->expects($this->once())->method('choice')->with(
'What kind of redirect do you want your short URLs to have?',
$this->isType('array'),
$this->isArray(),
$this->anything(),
)->willReturn($choice);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function expectedQuestionIsAsked(string $choice): void
. '<options=bold;fg=yellow> Warning!</> <comment>This feature is experimental. It only applies to public '
. 'routes (short URLs and QR codes). REST API routes always use strict match.</comment>'
. PHP_EOL,
$this->isType('array'),
$this->isArray(),
'strict',
)->willReturn($choice);

Expand Down
2 changes: 1 addition & 1 deletion test/Service/InstallationCommandsRunnerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class InstallationCommandsRunnerTest extends TestCase
public function setUp(): void
{
$phpFinder = $this->createMock(PhpExecutableFinder::class);
$phpFinder->method('find')->with(false)->willReturn('php');
$phpFinder->method('find')->willReturn('php');

$this->processHelper = $this->createMock(ProcessHelper::class);
$this->commandsRunner = new InstallationCommandsRunner(
Expand Down

0 comments on commit 7a77320

Please sign in to comment.