Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3938399
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/tests/Jobs/NotifyNewCommitsToDiffusionTest.php b/tests/Jobs/NotifyNewCommitsToDiffusionTest.php
index f7350fd..b3df6e8 100644
--- a/tests/Jobs/NotifyNewCommitsToDiffusionTest.php
+++ b/tests/Jobs/NotifyNewCommitsToDiffusionTest.php
@@ -1,72 +1,72 @@
<?php
namespace Nasqueron\Notifications\Tests\Jobs;
use Nasqueron\Notifications\Jobs\Job;
use Nasqueron\Notifications\Jobs\NotifyNewCommitsToDiffusion;
use Nasqueron\Notifications\Tests\TestCase;
class NotifyNewCommitsToDiffusionTest extends TestCase {
///
/// Tests
///
/**
* @dataProvider apiRepositoryReplyProvider
*/
public function testHandle(?array $apiRepositoryReply, int $apiCallCounts) {
$this->mockPhabricatorAPI()
->shouldReceive('getForProject->call')
->andReturn(
// First API call: repository.query
$apiRepositoryReply,
// Second API call: diffusion.looksoon
null
)
->times($apiCallCounts); // 2 when repository.query is valid
// 1 otherwise
$job = $this->mockJob();
$job->handle();
}
public function testJobWhenThereIsNoPhabricatorInstanceForTheProject () : void {
$job = $this->mockJob("not-existing-project");
$job->handle();
- $this->markTestIncomplete();
+ $this->expectNotToPerformAssertions();
}
///
/// Helper methods
///
/**
* Mocks a job
*/
protected function mockJob(string $project = "acme") : Job {
return new NotifyNewCommitsToDiffusion(
$project,
"ssh://acme/k2.git"
);
}
/**
* Provides API repository reply and associated API calls count
*/
public function apiRepositoryReplyProvider () : array {
return [
// Regular behavior
[[new class { public $callsign = "K2"; }], 2],
// Phabricator doesn't know this repo
[[], 1],
// Some error occurs and the API reply is null
[null, 1],
];
}
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Thu, Dec 26, 01:46 (5 h, 19 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2314371
Default Alt Text
(2 KB)
Attached To
Mode
rNOTIF Notifications center
Attached
Detach File
Event Timeline
Log In to Comment