| @@ 48-67 (lines=20) @@ | ||
| 45 | $this->shouldThrow('\InvalidArgumentException')->duringExecute(); |
|
| 46 | } |
|
| 47 | ||
| 48 | public function it_adds_a_file(FileReader $fileReader, HttpClient $http, Request $request, Response $response) |
|
| 49 | { |
|
| 50 | $localPath = __DIR__ . '/../../../fixtures/messages.en.yml'; |
|
| 51 | $this->addTranslation($localPath, 'path/to/crowdin.yml'); |
|
| 52 | $content = '<?xml version="1.0" encoding="ISO-8859-1"?><success></success>'; |
|
| 53 | $response->getBody()->willReturn($content); |
|
| 54 | $fakeResource = '[fake resource]'; |
|
| 55 | $fileReader->readTranslation(Argument::any())->willReturn($fakeResource); |
|
| 56 | $http->post( |
|
| 57 | 'project/sylius/add-file?key=1234', |
|
| 58 | ['multipart' => [ |
|
| 59 | [ |
|
| 60 | 'name' => 'files[path/to/crowdin.yml]', |
|
| 61 | 'contents' => $fakeResource |
|
| 62 | ] |
|
| 63 | ]] |
|
| 64 | )->willReturn($response); |
|
| 65 | ||
| 66 | $this->execute()->shouldBe($content); |
|
| 67 | } |
|
| 68 | } |
|
| 69 | ||
| @@ 47-65 (lines=19) @@ | ||
| 44 | $this->shouldThrow('\InvalidArgumentException')->duringExecute(); |
|
| 45 | } |
|
| 46 | ||
| 47 | public function it_updates_some_translation_files($fileReader, HttpClient $http, Request $request, Response $response) |
|
| 48 | { |
|
| 49 | $localPath = __DIR__ . '/../../../fixtures/messages.en.yml'; |
|
| 50 | $this->addTranslation($localPath, 'path/to/crowdin.yml'); |
|
| 51 | $content = '<xml></xml>'; |
|
| 52 | $response->getBody()->willReturn($content); |
|
| 53 | $fakeResource = '[fake resource]'; |
|
| 54 | $fileReader->readTranslation(Argument::any())->willReturn($fakeResource); |
|
| 55 | $http->post( |
|
| 56 | 'project/akeneo/update-file?key=1234', |
|
| 57 | ['multipart' => [ |
|
| 58 | [ |
|
| 59 | 'name' => "files[path/to/crowdin.yml]", |
|
| 60 | 'contents' => $fakeResource |
|
| 61 | ] |
|
| 62 | ]] |
|
| 63 | )->willReturn($response); |
|
| 64 | $this->execute()->shouldBe($content); |
|
| 65 | } |
|
| 66 | ||
| 67 | public function it_sends_additionnal_parameters(FileReader $fileReader, HttpClient $http, Request $request, Response $response) |
|
| 68 | { |
|