Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit b388537

Browse files
fix: #8 nullable
1 parent f5ffbab commit b388537

File tree

2 files changed

+27
-4
lines changed

2 files changed

+27
-4
lines changed

‎src/Iteration.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ public function create(array $data)
1919
$validator = Validator::getInstance()->make($data, [
2020
'ProjectName' => 'string|required',
2121
'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',
2626
]);
2727
if ($validator->fails()) {
2828
// TODO Laravel ValidationException no message

‎tests/IterationTest.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,29 @@ public function testCreateSuccessWithOnlyRequiredParams()
3030
$this->assertEquals($response['Iteration'], $result);
3131
}
3232

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+
3356
public function testCreateSuccessWithAllParams()
3457
{
3558
$coreMock = \Mockery::mock(Core::class, [])->makePartial();

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /