File tree Expand file tree Collapse file tree 5 files changed +79
-2
lines changed Expand file tree Collapse file tree 5 files changed +79
-2
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ before_install:
11
11
- travis_retry composer self-update
12
12
13
13
script :
14
- - ./vendor/bin/phpunit --verbose
14
+ - ./vendor/bin/phpunit --verbose tests/MockTest
15
15
16
16
matrix :
17
17
allow_failures :
Original file line number Diff line number Diff line change @@ -52,6 +52,7 @@ copy .env.example file to .env on your project root.
52
52
- [ Update issue] ( #update-issue )
53
53
- [ Add comment] ( #add-comment )
54
54
- [ Perform a transition on an issue] ( #perform-a-transition-on-an-issue )
55
+ - [ Perform an advanced search, using the JQL] ( #perform-an-advanced-search )
55
56
56
57
## Get Project Info
57
58
@@ -273,6 +274,27 @@ try {
273
274
?>
274
275
````
275
276
277
+ ## Perform an advanced search
278
+
279
+ ```` php
280
+ <?php
281
+ require 'vendor/autoload.php';
282
+
283
+ use JiraRestApi\Issue\IssueService;
284
+
285
+ $jql = 'project not in (TEST) and assignee = currentUser() and status in (Resolved, closed)';
286
+
287
+ try {
288
+ $issueService = new IssueService();
289
+
290
+ $ret = $issueService->search($jql);
291
+ var_dump($ret);
292
+ } catch (JIRAException $e) {
293
+ $this->assertTrue(false, 'testSearch Failed : '.$e->getMessage());
294
+ }
295
+ ?>
296
+ ````
297
+
276
298
# License
277
299
278
300
Apache V2 License
Original file line number Diff line number Diff line change 7
7
"php" : " >=5.4.0" ,
8
8
"netresearch/jsonmapper" : " ~0.5" ,
9
9
"monolog/monolog" : " ~1.12" ,
10
- "vlucas/phpdotenv" : " ~1.0"
10
+ "vlucas/phpdotenv" : " ~1.0" ,
11
+ "mockery/mockery" : " ^0.9.4"
11
12
},
12
13
"require-dev" : {
13
14
"phpunit/phpunit" : " ~4.4"
Original file line number Diff line number Diff line change @@ -155,4 +155,18 @@ public function testTransition($issueKey)
155
155
}
156
156
}
157
157
//
158
+
159
+ public function testSearch ()
160
+ {
161
+ $ issueKey = 'q ' ;
162
+ $ jql = 'project not in (TEST) and assignee = currentUser() and status in (Resolved, closed) ' ;
163
+ try {
164
+ $ issueService = new IssueService ();
165
+
166
+ $ ret = $ issueService ->search ($ jql );
167
+ var_dump ($ ret );
168
+ } catch (JIRAException $ e ) {
169
+ $ this ->assertTrue (false , 'testSearch Failed : ' .$ e ->getMessage ());
170
+ }
171
+ }
158
172
}
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ use JiraRestApi \Project \ProjectService ;
4
+
5
+ use \Mockery as m ;
6
+
7
+ class Temperature
8
+ {
9
+ public function __construct ($ service )
10
+ {
11
+ $ this ->_service = $ service ;
12
+ }
13
+
14
+ public function average ()
15
+ {
16
+ $ total = 0 ;
17
+ for ($ i =0 ;$ i <3 ;$ i ++) {
18
+ $ total += $ this ->_service ->readTemp ();
19
+ }
20
+ return $ total /3 ;
21
+ }
22
+ }
23
+
24
+ class MockTest extends PHPUnit_Framework_TestCase
25
+ {
26
+ public function tearDown ()
27
+ {
28
+ m::close ();
29
+ }
30
+
31
+ public function testGetsAverageTemperatureFromThreeServiceReadings ()
32
+ {
33
+ $ service = m::mock ('service ' );
34
+ $ service ->shouldReceive ('readTemp ' )->times (3 )->andReturn (10 , 12 , 14 );
35
+
36
+ $ temperature = new Temperature ($ service );
37
+
38
+ $ this ->assertEquals (12 , $ temperature ->average ());
39
+ }
40
+ }
You can’t perform that action at this time.
0 commit comments