Skip to content

Commit

Permalink
Feat.add test textmasters (#96)
Browse files Browse the repository at this point in the history
* Add test for create project with no textmaster

* Update textmaster id
  • Loading branch information
LaetitiaRiffaud authored and Pierre Ducoudray committed Feb 8, 2017
1 parent 1754907 commit 2f66be0
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 4 deletions.
36 changes: 36 additions & 0 deletions test/Textmaster/Functional/Api/ProjectTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,42 @@ public function shouldCreateProject()
return $result['id'];
}

/**
* @test
*/
public function shouldCreateProjectWithEmptyTextmasters()
{
$params = [
'name' => 'Created project for functional test',
'ctype' => ProjectInterface::ACTIVITY_TRANSLATION,
'options' => [
'language_level' => 'premium',
],
'language_from' => 'fr',
'language_to' => 'en',
'category' => 'C021',
'project_briefing' => 'This project is only for testing purpose',
'work_template' => '1_title_2_paragraphs',
'textmasters' => [],
];

$result = $this->api->create($params);

$this->assertSame('Created project for functional test', $result['name']);
$this->assertSame(ProjectInterface::ACTIVITY_TRANSLATION, $result['ctype']);
$this->assertSame('premium', $result['options']['language_level']);
$this->assertSame('fr', $result['language_from']);
$this->assertSame('en', $result['language_to']);
$this->assertSame('C021', $result['category']);
$this->assertSame('This project is only for testing purpose', $result['project_briefing']);
$this->assertSame(ProjectInterface::STATUS_IN_CREATION, $result['status']);
$this->assertSame('api', $result['creation_channel']);
$this->assertSame('1_title_2_paragraphs', $result['work_template']['name']);
$this->assertSame([], $result['textmasters']);

return $result['id'];
}

/**
* @test
*/
Expand Down
8 changes: 4 additions & 4 deletions test/Textmaster/Unit/Model/ProjectTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function setUp()
'category' => 'C014',
'project_briefing' => 'Lorem ipsum...',
'options' => ['language_level' => 'premium'],
'textmasters' => ['A-3727-TM'],
'textmasters' => ['55c3763e656462000b000027'],
];
$updateValues = [
'id' => '123456',
Expand All @@ -46,7 +46,7 @@ public function setUp()
'category' => 'C014',
'project_briefing' => 'Lorem ipsum...',
'options' => ['language_level' => 'premium'],
'textmasters' => ['A-3727-TM'],
'textmasters' => ['55c3763e656462000b000027'],
];

$clientMock = $this->getMockBuilder('Textmaster\Client')->setMethods(['api'])->disableOriginalConstructor()->getMock();
Expand Down Expand Up @@ -83,7 +83,7 @@ public function shouldCreateEmpty()
$briefing = 'Lorem ipsum...';
$options = ['language_level' => 'premium'];
$callback = [ProjectInterface::CALLBACK_PROJECT_IN_PROGRESS => 'http://callback.url'];
$textmasters = ['53d7bf7c53ecaaf8aa000514'];
$textmasters = ['55c3763e656462000b000027'];

$project = new Project($this->clientMock);
$project
Expand Down Expand Up @@ -125,7 +125,7 @@ public function shouldCreateFromValues()
$category = 'C014';
$briefing = 'Lorem ipsum...';
$options = ['language_level' => 'premium'];
$textmasters = ['A-3727-TM'];
$textmasters = ['55c3763e656462000b000027'];

$values = [
'id' => $id,
Expand Down

0 comments on commit 2f66be0

Please sign in to comment.