Skip to content

Commit 09a2a4b

Browse files
jmlerouxPierre Ducoudray
authored and
Pierre Ducoudray
committed
Add project documents statuses getter. (#103)
1 parent 37c4f82 commit 09a2a4b

File tree

3 files changed

+45
-0
lines changed

3 files changed

+45
-0
lines changed

lib/Textmaster/Model/Project.php

+8
Original file line numberDiff line numberDiff line change
@@ -384,4 +384,12 @@ protected function getEventNamePrefix()
384384
{
385385
return 'textmaster.project';
386386
}
387+
388+
/**
389+
* {@inheritdoc}
390+
*/
391+
public function getDocumentsStatuses()
392+
{
393+
return $this->getProperty('documents_statuses');
394+
}
387395
}

lib/Textmaster/Model/ProjectInterface.php

+8
Original file line numberDiff line numberDiff line change
@@ -288,4 +288,12 @@ public function getPotentialAuthors($status = null);
288288
* @return ProjectInterface
289289
*/
290290
public function launch();
291+
292+
/**
293+
* Get project documents statuses summary.
294+
* @see https://eu.app.textmaster.com/api-documentation#projects-get-a-project
295+
*
296+
* @return int[]
297+
*/
298+
public function getDocumentsStatuses();
291299
}

test/Textmaster/Unit/Model/ProjectTest.php

+29
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,19 @@ public function setUp()
3636
'project_briefing' => 'Lorem ipsum...',
3737
'options' => ['language_level' => 'premium'],
3838
'textmasters' => ['55c3763e656462000b000027'],
39+
'documents_statuses' => [
40+
'in_creation' => 0,
41+
'waiting_assignment' => 2,
42+
'in_progress' => 0,
43+
'in_review' => 0,
44+
'incomplete' => 0,
45+
'completed' => 0,
46+
'paused' => 0,
47+
'canceled' => 0,
48+
'quality_control' => 0,
49+
'copyscape' => 0,
50+
'counting_words' => 1,
51+
],
3952
];
4053
$updateValues = [
4154
'id' => '123456',
@@ -167,6 +180,19 @@ public function shouldCreateFromValues()
167180
$briefing = 'Lorem ipsum...';
168181
$options = ['language_level' => 'premium'];
169182
$textmasters = ['55c3763e656462000b000027'];
183+
$documentsStatuses = [
184+
'in_creation' => 0,
185+
'waiting_assignment' => 2,
186+
'in_progress' => 0,
187+
'in_review' => 0,
188+
'incomplete' => 0,
189+
'completed' => 0,
190+
'paused' => 0,
191+
'canceled' => 0,
192+
'quality_control' => 0,
193+
'copyscape' => 0,
194+
'counting_words' => 1,
195+
];
170196

171197
$values = [
172198
'id' => $id,
@@ -179,6 +205,7 @@ public function shouldCreateFromValues()
179205
'project_briefing' => $briefing,
180206
'options' => $options,
181207
'textmasters' => $textmasters,
208+
'documents_statuses' => $documentsStatuses,
182209
];
183210

184211
$project = new Project($this->clientMock, $values);
@@ -193,6 +220,8 @@ public function shouldCreateFromValues()
193220
$this->assertSame($briefing, $project->getBriefing());
194221
$this->assertSame($options, $project->getOptions());
195222
$this->assertSame($textmasters, $project->getTextmasters());
223+
$this->assertEquals(2, $project->getDocumentsStatuses()[DocumentInterface::STATUS_WAITING_ASSIGNMENT]);
224+
$this->assertEquals(1, $project->getDocumentsStatuses()[DocumentInterface::STATUS_COUNTING_WORDS]);
196225
}
197226

198227
/**

0 commit comments

Comments
 (0)