Movatterモバイル変換


[0]ホーム

URL:


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

Commitf5ffbab

Browse files
committed
fix:#6 support Autowiring
1 parent984523c commitf5ffbab

File tree

4 files changed

+15
-3
lines changed

4 files changed

+15
-3
lines changed

‎src/Core.php‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,9 @@ public function request(string $action, $data)
3434
}
3535
return$result['Response'];
3636
}
37+
38+
publicfunctionsetToken(string$token)
39+
{
40+
$this->token =$token;
41+
}
3742
}

‎src/Iteration.php‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class Iteration
99
{
1010
privateCore$core;
1111

12-
publicfunction__construct(string$token,Core$core =null)
12+
publicfunction__construct(string$token ='',Core$core =null)
1313
{
1414
$this->core =$core ??newCore($token);
1515
}
@@ -31,4 +31,9 @@ public function create(array $data)
3131
$response =$this->core->request('CreateIteration',$data);
3232
return$response['Iteration'];
3333
}
34+
35+
publicfunctionsetToken(string$token)
36+
{
37+
$this->core->setToken($token);
38+
}
3439
}

‎tests/CoreTest.php‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ public function testRequestFailed()
6161
]
6262
)
6363
->willReturn(newResponse(200, [],$responseBody));
64-
$core =newCore($this->token,$this->clientMock);
64+
$core =newCore('',$this->clientMock);
65+
$core->setToken($this->token);
6566
$this->expectException(ApiError::class);
6667
$this->expectExceptionMessage(json_decode($responseBody,true)['Response']['Error']['Message']);
6768
$core->request($action,$data);

‎tests/IterationTest.php‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ public function testCreateSuccessWithAllParams()
5252
$data
5353
])->andReturn($response);
5454

55-
$iteration =newIteration($this->token,$coreMock);
55+
$iteration =newIteration('',$coreMock);
56+
$iteration->setToken($this->token);
5657
$result =$iteration->create($data);
5758
$this->assertEquals($response['Iteration'],$result);
5859
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp