Page MenuHomeDevCentral

D753.id1890.diff
No OneTemporary

D753.id1890.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
@@ -168,9 +168,19 @@
///
private function mockPhabricatorAPIWithReply ($reply) {
- return Mockery::mock('Nasqueron\Notifications\Contract\APIClient')
- ->shouldReceive('call')
- ->andReturn($reply);
+ return (new class($reply) implements \Nasqueron\Notifications\Contracts\APIClient {
+ private $reply;
+
+ public function __construct ($reply) {
+ $this->reply = $reply;
+ }
+
+ public function setEndPoint ($url) : void { }
+
+ public function call ($method, $arguments = []) {
+ return $this->reply;
+ }
+ });
}
/**
@@ -188,5 +198,4 @@
$mock = $this->mockPhabricatorAPIWithReply(new \stdClass);
ProjectsMap::fetch("http://phabricator.acme.tld", $mock);
}
-
}

File Metadata

Mime Type
text/plain
Expires
Sat, Sep 28, 21:26 (20 h, 27 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2162591
Default Alt Text
D753.id1890.diff (2 KB)

Event Timeline