Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 6 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
language: php

php:
- 7.1
- 7.2
- 7.3
- 7.4
- nightly # ignore errors, see below

# lock distro so new future defaults will not break the build
dist: trusty

matrix:
allow_failures:
- php: nightly
jobs:
include:
- php: 7.1
- php: 7.2
- php: 7.3
- php: 7.4

install:
- composer install
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"php": ">=7.1.0"
},
"require-dev": {
"phpunit/phpunit": "^7"
"phpunit/phpunit": "^9.0 || ^7.5"
},
"autoload": {
"psr-4": {
Expand Down
11 changes: 1 addition & 10 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit backupGlobals="false"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
bootstrap="vendor/autoload.php"
>
<phpunit bootstrap="vendor/autoload.php" colors="true">
<testsuites>
<testsuite name="Promise Test Suite">
<directory>./tests/</directory>
Expand Down
4 changes: 2 additions & 2 deletions tests/PromiseTest/PromiseFulfilledTestTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ public function doneShouldTriggerFatalErrorThrownFulfillmentHandlerForFulfilledP
$errors = $errorCollector->stop();

self::assertEquals(E_USER_ERROR, $errors[0]['errno']);
self::assertContains('Unhandled Rejection', $errors[0]['errstr']);
self::assertStringContainsString('Unhandled Rejection', $errors[0]['errstr']);
}

/** @test */
Expand All @@ -257,7 +257,7 @@ public function doneShouldTriggerFatalErrorUnhandledRejectionExceptionWhenFulfil
$errors = $errorCollector->stop();

self::assertEquals(E_USER_ERROR, $errors[0]['errno']);
self::assertContains('Unhandled Rejection', $errors[0]['errstr']);
self::assertStringContainsString('Unhandled Rejection', $errors[0]['errstr']);
}

/** @test */
Expand Down
4 changes: 2 additions & 2 deletions tests/PromiseTest/PromiseRejectedTestTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ public function doneShouldTriggerFatalErrorExceptionThrownByRejectionHandlerForR
$errors = $errorCollector->stop();

self::assertEquals(E_USER_ERROR, $errors[0]['errno']);
self::assertContains('Unhandled Rejection', $errors[0]['errstr']);
self::assertStringContainsString('Unhandled Rejection', $errors[0]['errstr']);
}

/** @test */
Expand All @@ -248,7 +248,7 @@ public function doneShouldTriggerFatalErrorRejectionExceptionWhenRejectionHandle
$errors = $errorCollector->stop();

self::assertEquals(E_USER_ERROR, $errors[0]['errno']);
self::assertContains('Unhandled Rejection', $errors[0]['errstr']);
self::assertStringContainsString('Unhandled Rejection', $errors[0]['errstr']);
}

/** @test */
Expand Down
8 changes: 4 additions & 4 deletions tests/PromiseTest/RejectTestTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public function doneShouldTriggerFatalErrorExceptionThrownByRejectionHandler()
$errors = $errorCollector->stop();

self::assertEquals(E_USER_ERROR, $errors[0]['errno']);
self::assertContains('Unhandled Rejection', $errors[0]['errstr']);
self::assertStringContainsString('Unhandled Rejection', $errors[0]['errstr']);
}

/** @test */
Expand All @@ -161,7 +161,7 @@ public function doneShouldTriggerFatalErrorRejectionExceptionWhenRejectionHandle
$errors = $errorCollector->stop();

self::assertEquals(E_USER_ERROR, $errors[0]['errno']);
self::assertContains('Unhandled Rejection', $errors[0]['errstr']);
self::assertStringContainsString('Unhandled Rejection', $errors[0]['errstr']);
}

/** @test */
Expand All @@ -184,7 +184,7 @@ public function doneShouldTriggerFatalErrorUnhandledRejectionExceptionWhenReject
$errors = $errorCollector->stop();

self::assertEquals(E_USER_ERROR, $errors[0]['errno']);
self::assertContains('Unhandled Rejection', $errors[0]['errstr']);
self::assertStringContainsString('Unhandled Rejection', $errors[0]['errstr']);
}

/** @test */
Expand All @@ -201,7 +201,7 @@ public function doneShouldTriggerFatalErrorExceptionProvidedAsRejectionValue()
$errors = $errorCollector->stop();

self::assertEquals(E_USER_ERROR, $errors[0]['errno']);
self::assertContains('Unhandled Rejection', $errors[0]['errstr']);
self::assertStringContainsString('Unhandled Rejection', $errors[0]['errstr']);
}

/** @test */
Expand Down
4 changes: 2 additions & 2 deletions tests/PromiseTest/ResolveTestTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ public function doneShouldTriggerFatalErrorExceptionThrownFulfillmentHandler()
$errors = $errorCollector->stop();

self::assertEquals(E_USER_ERROR, $errors[0]['errno']);
self::assertContains('Unhandled Rejection', $errors[0]['errstr']);
self::assertStringContainsString('Unhandled Rejection', $errors[0]['errstr']);
}

/** @test */
Expand All @@ -219,7 +219,7 @@ public function doneShouldTriggerFatalErrorUnhandledRejectionExceptionWhenFulfil
$errors = $errorCollector->stop();

self::assertEquals(E_USER_ERROR, $errors[0]['errno']);
self::assertContains('Unhandled Rejection', $errors[0]['errstr']);
self::assertStringContainsString('Unhandled Rejection', $errors[0]['errstr']);
}

/** @test */
Expand Down
10 changes: 0 additions & 10 deletions tests/Stub/CallableStub.php

This file was deleted.

12 changes: 8 additions & 4 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,14 @@ public function expectCallableNever(): callable
return $mock;
}

public function createCallableMock()
protected function createCallableMock()
{
return $this
->getMockBuilder(CallableStub::class)
->getMock();
if (method_exists('PHPUnit\Framework\MockObject\MockBuilder', 'addMethods')) {
// PHPUnit 9+
return $this->getMockBuilder('stdClass')->addMethods(array('__invoke'))->getMock();
} else {
// legacy PHPUnit 4 - PHPUnit 9
return $this->getMockBuilder('stdClass')->setMethods(array('__invoke'))->getMock();
}
}
}