Skip to content

Commit

Permalink
Add project documents statuses getter. (#103)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmleroux authored and Pierre Ducoudray committed Jan 23, 2018
1 parent 37c4f82 commit 09a2a4b
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/Textmaster/Model/Project.php
Original file line number Diff line number Diff line change
Expand Up @@ -384,4 +384,12 @@ protected function getEventNamePrefix()
{
return 'textmaster.project';
}

/**
* {@inheritdoc}
*/
public function getDocumentsStatuses()
{
return $this->getProperty('documents_statuses');
}
}
8 changes: 8 additions & 0 deletions lib/Textmaster/Model/ProjectInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -288,4 +288,12 @@ public function getPotentialAuthors($status = null);
* @return ProjectInterface
*/
public function launch();

/**
* Get project documents statuses summary.
* @see https://eu.app.textmaster.com/api-documentation#projects-get-a-project
*
* @return int[]
*/
public function getDocumentsStatuses();
}
29 changes: 29 additions & 0 deletions test/Textmaster/Unit/Model/ProjectTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,19 @@ public function setUp()
'project_briefing' => 'Lorem ipsum...',
'options' => ['language_level' => 'premium'],
'textmasters' => ['55c3763e656462000b000027'],
'documents_statuses' => [
'in_creation' => 0,
'waiting_assignment' => 2,
'in_progress' => 0,
'in_review' => 0,
'incomplete' => 0,
'completed' => 0,
'paused' => 0,
'canceled' => 0,
'quality_control' => 0,
'copyscape' => 0,
'counting_words' => 1,
],
];
$updateValues = [
'id' => '123456',
Expand Down Expand Up @@ -167,6 +180,19 @@ public function shouldCreateFromValues()
$briefing = 'Lorem ipsum...';
$options = ['language_level' => 'premium'];
$textmasters = ['55c3763e656462000b000027'];
$documentsStatuses = [
'in_creation' => 0,
'waiting_assignment' => 2,
'in_progress' => 0,
'in_review' => 0,
'incomplete' => 0,
'completed' => 0,
'paused' => 0,
'canceled' => 0,
'quality_control' => 0,
'copyscape' => 0,
'counting_words' => 1,
];

$values = [
'id' => $id,
Expand All @@ -179,6 +205,7 @@ public function shouldCreateFromValues()
'project_briefing' => $briefing,
'options' => $options,
'textmasters' => $textmasters,
'documents_statuses' => $documentsStatuses,
];

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

/**
Expand Down

0 comments on commit 09a2a4b

Please sign in to comment.