This repository has been archived by the owner on Aug 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Jenkins.spec.php
54 lines (51 loc) · 1.74 KB
/
Jenkins.spec.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
/**
* This file is part of CoverallsKit.
*
* (c) Noritaka Horio <holy.shared.design@gmail.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace coverallskit\spec;
use coverallskit\Environment;
use coverallskit\environment\Jenkins;
describe(Jenkins::class, function () {
describe('#getName', function () {
it('return adapter name', function () {
$this->jenkins = new Jenkins(new Environment());
expect($this->jenkins->getName())->toBe('jenkins');
});
});
describe('#getBuildJobId', function () {
it('return build job id', function () {
$environment = new Environment([
'BUILD_NUMBER' => 101
]);
$this->jenkins = new Jenkins($environment);
expect($this->jenkins->getBuildJobId())->toBe(101);
});
});
describe('#isSupported', function () {
context('when jenkins enviroment', function () {
beforeEach(function () {
$environment = new Environment([
'JENKINS_URL' => 'http://example.com'
]);
$this->jenkins = new Jenkins($environment);
});
it('return true', function () {
expect($this->jenkins->isSupported())->toBeTrue();
});
});
context('when not jenkins enviroment', function () {
beforeEach(function () {
$environment = new Environment();
$this->jenkins = new Jenkins($environment);
});
it('return false', function () {
expect($this->jenkins->isSupported())->toBeFalse();
});
});
});
});