Skip to content

Commit

Permalink
Merge pull request #1446 from ciaranmcnulty/allow-phpunit-10
Browse files Browse the repository at this point in the history
Allow phpunit 10
  • Loading branch information
ciaranmcnulty committed Apr 21, 2023
2 parents 2e1e256 + bce5944 commit d382a84
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 45 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ jobs:
composer-extras: "symfony/event-dispatcher ^3.4 symfony/contracts ^2.0"
- php: "8.0"
operating-system: windows-latest
- php: "8.2"
stability: "dev"

env:
COMPOSER_ROOT_VERSION: dev-master
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"require-dev": {
"behat/behat": "^3.3",
"symfony/filesystem": "^3.4 || ^4.0 || ^5.0 || ^6.0",
"phpunit/phpunit": "^8.0 || ^9.0",
"phpunit/phpunit": "^8.0 || ^9.0 || ^10.0",
"vimeo/psalm": "^4.3 || ^5.2"
},

Expand Down
10 changes: 9 additions & 1 deletion features/bootstrap/FilesystemContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,14 @@ public function iHaveNotConfiguredAnAutoloader()
*/
public function thereShouldBeNoFile($path)
{
Assert::assertFileNotExists($path);
if (method_exists(Assert::class, 'assertFileDoesNotExist')) {
Assert::assertFileDoesNotExist($path);
}
elseif (method_exists(Assert::class, 'assertFileNotExists')) {
Assert::assertFileNotExists($path);
}
else {
Assert::assertFalse(file_exists($path));
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php

declare(strict_types=1);

namespace PhpSpec\Formatter\Presenter\Differ;

use PHPUnit\Framework\TestCase;
use SebastianBergmann\Exporter\Exporter;

class ObjectEngineTest extends TestCase
{
/** @var ObjectEngine */
private $engine;

/** @var Exporter */
private $exporter;

/** @var StringEngine */
private $stringDiffer;

public function setUp() : void
{
$this->exporter = new Exporter();
$this->stringDiffer = $this->createMock(StringEngine::class);
$this->engine = new ObjectEngine($this->exporter, $this->stringDiffer);
}

/** @test */
public function it_is_an_differ_engine()
{
self::assertInstanceOf(DifferEngine::class, $this->engine);
}

/** @test */
public function it_does_not_support_scalars()
{
self::assertFalse($this->engine->supports(1, 2));
}

/** @test */
public function it_only_supports_objects()
{
self::assertTrue($this->engine->supports(new \StdClass(), new \StdClass()));
}

/** @test */
public function it_converts_objects_to_string_and_diffs_the_result()
{
$this->stringDiffer->method('compare')
->willReturn('-DateTime+ArrayObject');

$diff = $this->engine->compare(new \DateTime(), new \ArrayObject());

self::assertSame('-DateTime+ArrayObject', $diff);
}
}
43 changes: 0 additions & 43 deletions spec/PhpSpec/Formatter/Presenter/Differ/ObjectEngineSpec.php

This file was deleted.

0 comments on commit d382a84

Please sign in to comment.