From 2f66be07b267045aa7938d9d49ffb7bff9e4f44a Mon Sep 17 00:00:00 2001 From: LaetitiaRiffaud Date: Wed, 8 Feb 2017 10:48:30 +0100 Subject: [PATCH] Feat.add test textmasters (#96) * Add test for create project with no textmaster * Update textmaster id --- .../Textmaster/Functional/Api/ProjectTest.php | 36 +++++++++++++++++++ test/Textmaster/Unit/Model/ProjectTest.php | 8 ++--- 2 files changed, 40 insertions(+), 4 deletions(-) diff --git a/test/Textmaster/Functional/Api/ProjectTest.php b/test/Textmaster/Functional/Api/ProjectTest.php index 446e225..9e74a13 100644 --- a/test/Textmaster/Functional/Api/ProjectTest.php +++ b/test/Textmaster/Functional/Api/ProjectTest.php @@ -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 */ diff --git a/test/Textmaster/Unit/Model/ProjectTest.php b/test/Textmaster/Unit/Model/ProjectTest.php index 607e395..640be8b 100644 --- a/test/Textmaster/Unit/Model/ProjectTest.php +++ b/test/Textmaster/Unit/Model/ProjectTest.php @@ -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', @@ -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(); @@ -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 @@ -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,