Page MenuHomeDevCentral

D753.diff
No OneTemporary

D753.diff

diff --git a/app/Phabricator/ProjectsMap.php b/app/Phabricator/ProjectsMap.php
--- a/app/Phabricator/ProjectsMap.php
+++ b/app/Phabricator/ProjectsMap.php
@@ -2,7 +2,7 @@
namespace Nasqueron\Notifications\Phabricator;
-use Nasqueron\Notifications\Phabricator\PhabricatorAPIClient as ApiClient;
+use Nasqueron\Notifications\Contracts\APIClient as APIClient;
use App;
use Cache;
@@ -143,7 +143,7 @@
* @param Nasqueron\Notifications\Contracts\APIClient $apiClient The Phabricator API client
* @return ProjectsMap
*/
- public static function fetch ($phabricatorInstanceName, APIClient $apiClient = null) {
+ public static function fetch ($phabricatorInstanceName, ?APIClient $apiClient = null) {
$instance = new self($phabricatorInstanceName);
$instance->setAPIClient($apiClient);
$instance->fetchFromAPI();
@@ -168,7 +168,7 @@
/**
* @param Nasqueron\Notifications\Contracts\APIClient $apiClient
*/
- public function setAPIClient (APIClient $apiClient = null) {
+ public function setAPIClient (?APIClient $apiClient = null) {
$this->apiClient = $apiClient;
}
diff --git a/composer.json b/composer.json
--- a/composer.json
+++ b/composer.json
@@ -10,7 +10,7 @@
"license": "BSD-2-Clause",
"type": "project",
"require": {
- "php": ">=5.6.0",
+ "php": ">=7.1.0",
"laravel/framework": "5.2.*",
"guzzlehttp/guzzle": "^6.2",
"keruald/dockerhub": "^0.0.3",
diff --git a/tests/Phabricator/ProjectsMapTest.php b/tests/Phabricator/ProjectsMapTest.php
--- a/tests/Phabricator/ProjectsMapTest.php
+++ b/tests/Phabricator/ProjectsMapTest.php
@@ -2,6 +2,7 @@
namespace Nasqueron\Notifications\Tests\Phabricator;
+use Nasqueron\Notifications\Contracts\APIClient;
use Nasqueron\Notifications\Phabricator\ProjectsMap;
use Nasqueron\Notifications\Tests\TestCase;
@@ -167,10 +168,20 @@
/// Tests API
///
- private function mockPhabricatorAPIWithReply ($reply) {
- return Mockery::mock('Nasqueron\Notifications\Contract\APIClient')
- ->shouldReceive('call')
- ->andReturn($reply);
+ private function mockPhabricatorAPIWithReply ($reply) : APIClient {
+ return (new class($reply) implements APIClient {
+ private $reply;
+
+ public function __construct ($reply) {
+ $this->reply = $reply;
+ }
+
+ public function setEndPoint ($url) : void { }
+
+ public function call ($method, $arguments = []) {
+ return $this->reply;
+ }
+ });
}
/**

File Metadata

Mime Type
text/plain
Expires
Wed, Nov 6, 05:21 (6 h, 3 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2231239
Default Alt Text
D753.diff (2 KB)

Event Timeline