File tree 2 files changed +27
-4
lines changed
2 files changed +27
-4
lines changed Original file line number Diff line number Diff line change @@ -19,10 +19,10 @@ public function create(array $data)
19
19
$ validator = Validator::getInstance ()->make ($ data , [
20
20
'ProjectName ' => 'string|required ' ,
21
21
'Name ' => 'string|required ' ,
22
- 'Goal ' => 'string ' ,
23
- 'Assignee ' => 'integer ' ,
24
- 'StartAt ' => 'date_format:Y-m-d ' ,
25
- 'EndAt ' => 'date_format:Y-m-d|after:StartAt ' ,
22
+ 'Goal ' => 'nullable| string ' ,
23
+ 'Assignee ' => 'nullable| integer ' ,
24
+ 'StartAt ' => 'nullable| date_format:Y-m-d ' ,
25
+ 'EndAt ' => 'nullable| date_format:Y-m-d|after:StartAt ' ,
26
26
]);
27
27
if ($ validator ->fails ()) {
28
28
// TODO Laravel ValidationException no message
Original file line number Diff line number Diff line change @@ -30,6 +30,29 @@ public function testCreateSuccessWithOnlyRequiredParams()
30
30
$ this ->assertEquals ($ response ['Iteration ' ], $ result );
31
31
}
32
32
33
+ public function testCreateSuccessWithRequiredParamsAndNull ()
34
+ {
35
+ $ coreMock = \Mockery::mock (Core::class, [])->makePartial ();
36
+
37
+ $ response = json_decode (
38
+ file_get_contents ($ this ->dataPath ('CreateIterationResponse.json ' )),
39
+ true
40
+ )['Response ' ];
41
+ $ data = [
42
+ 'ProjectName ' => $ this ->projectName ,
43
+ 'Name ' => $ this ->faker ->title ,
44
+ 'Goal ' => null ,
45
+ ];
46
+ $ coreMock ->shouldReceive ('request ' )->times (1 )->withArgs ([
47
+ 'CreateIteration ' ,
48
+ $ data
49
+ ])->andReturn ($ response );
50
+
51
+ $ iteration = new Iteration ($ this ->token , $ coreMock );
52
+ $ result = $ iteration ->create ($ data );
53
+ $ this ->assertEquals ($ response ['Iteration ' ], $ result );
54
+ }
55
+
33
56
public function testCreateSuccessWithAllParams ()
34
57
{
35
58
$ coreMock = \Mockery::mock (Core::class, [])->makePartial ();
You can’t perform that action at this time.
0 commit comments