Skip to content

Commit 2f66be0

Browse files
LaetitiaRiffaudPierre Ducoudray
authored andcommitted
Feat.add test textmasters (#96)
* Add test for create project with no textmaster * Update textmaster id
1 parent 1754907 commit 2f66be0

File tree

2 files changed

+40
-4
lines changed

2 files changed

+40
-4
lines changed

test/Textmaster/Functional/Api/ProjectTest.php

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,42 @@ public function shouldCreateProject()
152152
return $result['id'];
153153
}
154154

155+
/**
156+
* @test
157+
*/
158+
public function shouldCreateProjectWithEmptyTextmasters()
159+
{
160+
$params = [
161+
'name' => 'Created project for functional test',
162+
'ctype' => ProjectInterface::ACTIVITY_TRANSLATION,
163+
'options' => [
164+
'language_level' => 'premium',
165+
],
166+
'language_from' => 'fr',
167+
'language_to' => 'en',
168+
'category' => 'C021',
169+
'project_briefing' => 'This project is only for testing purpose',
170+
'work_template' => '1_title_2_paragraphs',
171+
'textmasters' => [],
172+
];
173+
174+
$result = $this->api->create($params);
175+
176+
$this->assertSame('Created project for functional test', $result['name']);
177+
$this->assertSame(ProjectInterface::ACTIVITY_TRANSLATION, $result['ctype']);
178+
$this->assertSame('premium', $result['options']['language_level']);
179+
$this->assertSame('fr', $result['language_from']);
180+
$this->assertSame('en', $result['language_to']);
181+
$this->assertSame('C021', $result['category']);
182+
$this->assertSame('This project is only for testing purpose', $result['project_briefing']);
183+
$this->assertSame(ProjectInterface::STATUS_IN_CREATION, $result['status']);
184+
$this->assertSame('api', $result['creation_channel']);
185+
$this->assertSame('1_title_2_paragraphs', $result['work_template']['name']);
186+
$this->assertSame([], $result['textmasters']);
187+
188+
return $result['id'];
189+
}
190+
155191
/**
156192
* @test
157193
*/

test/Textmaster/Unit/Model/ProjectTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function setUp()
3434
'category' => 'C014',
3535
'project_briefing' => 'Lorem ipsum...',
3636
'options' => ['language_level' => 'premium'],
37-
'textmasters' => ['A-3727-TM'],
37+
'textmasters' => ['55c3763e656462000b000027'],
3838
];
3939
$updateValues = [
4040
'id' => '123456',
@@ -46,7 +46,7 @@ public function setUp()
4646
'category' => 'C014',
4747
'project_briefing' => 'Lorem ipsum...',
4848
'options' => ['language_level' => 'premium'],
49-
'textmasters' => ['A-3727-TM'],
49+
'textmasters' => ['55c3763e656462000b000027'],
5050
];
5151

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

8888
$project = new Project($this->clientMock);
8989
$project
@@ -125,7 +125,7 @@ public function shouldCreateFromValues()
125125
$category = 'C014';
126126
$briefing = 'Lorem ipsum...';
127127
$options = ['language_level' => 'premium'];
128-
$textmasters = ['A-3727-TM'];
128+
$textmasters = ['55c3763e656462000b000027'];
129129

130130
$values = [
131131
'id' => $id,

0 commit comments

Comments
 (0)