From 2855a4f65a5332b16c211c82deb8fea56a5766ba Mon Sep 17 00:00:00 2001 From: faizan1191 Date: Tue, 3 Oct 2023 22:44:55 +0530 Subject: [PATCH] PHPCS fix --- .../Api/StringsExporterSettingApi.php | 4 +- .../Api/StringsExporterSettingApiTest.php | 158 +++++++++--------- .../Model/StringsExporterSettingTest.php | 2 +- 3 files changed, 82 insertions(+), 82 deletions(-) diff --git a/src/CrowdinApiClient/Api/StringsExporterSettingApi.php b/src/CrowdinApiClient/Api/StringsExporterSettingApi.php index 771d22cf..3f12ecb3 100644 --- a/src/CrowdinApiClient/Api/StringsExporterSettingApi.php +++ b/src/CrowdinApiClient/Api/StringsExporterSettingApi.php @@ -66,13 +66,13 @@ public function create(int $projectId, array $data): ?StringsExporterSetting * * @param int $projectId * @param StringsExporterSetting $stringsExporterSetting - * + * * @return StringsExporterSetting|null */ public function update(int $projectId, StringsExporterSetting $stringsExporterSetting): ?StringsExporterSetting { $path = sprintf('projects/%d/strings-exporter-settings/%d', $projectId, $stringsExporterSetting->getId()); - + return $this->_update($path, $stringsExporterSetting); } diff --git a/tests/CrowdinApiClient/Api/StringsExporterSettingApiTest.php b/tests/CrowdinApiClient/Api/StringsExporterSettingApiTest.php index 1e7b3624..22e0ce15 100644 --- a/tests/CrowdinApiClient/Api/StringsExporterSettingApiTest.php +++ b/tests/CrowdinApiClient/Api/StringsExporterSettingApiTest.php @@ -7,12 +7,12 @@ class StringsExporterSettingApiTest extends AbstractTestApi { - public function testList() - { - $this->mockRequest([ - 'path' => '/projects/2/strings-exporter-settings', - 'method' => 'get', - 'response' => '{ + public function testList() + { + $this->mockRequest([ + 'path' => '/projects/2/strings-exporter-settings', + 'method' => 'get', + 'response' => '{ "data": [ { "data": { @@ -31,27 +31,27 @@ public function testList() "limit": 25 } }' - ]); - - $data = $this->crowdin->stringsExporterSetting->list(2); - - $this->assertInstanceOf(ModelCollection::class, $data); - $this->assertCount(1, $data); - /** - * @var StringsExporterSetting $stringsExporterSetting - */ - $stringsExporterSetting = $data[0]; - $this->assertInstanceOf(StringsExporterSetting::class, $stringsExporterSetting); - - $this->assertEquals(2, $stringsExporterSetting->getId()); - $this->assertEquals('android', $stringsExporterSetting->getFormat()); - } - - public function testGet() - { - $this->mockRequestGet( - '/projects/2/strings-exporter-settings/2', - '{ + ]); + + $data = $this->crowdin->stringsExporterSetting->list(2); + + $this->assertInstanceOf(ModelCollection::class, $data); + $this->assertCount(1, $data); + /** + * @var StringsExporterSetting $stringsExporterSetting + */ + $stringsExporterSetting = $data[0]; + $this->assertInstanceOf(StringsExporterSetting::class, $stringsExporterSetting); + + $this->assertEquals(2, $stringsExporterSetting->getId()); + $this->assertEquals('android', $stringsExporterSetting->getFormat()); + } + + public function testGet() + { + $this->mockRequestGet( + '/projects/2/strings-exporter-settings/2', + '{ "data": { "id": 2, "format": "android", @@ -62,30 +62,30 @@ public function testGet() "updatedAt": "2019-09-19T15:10:46+00:00" } }' - ); - - $stringsExporterSetting = $this->crowdin->stringsExporterSetting->get(2, 2); - - $this->assertInstanceOf(StringsExporterSetting::class, $stringsExporterSetting); - - $this->assertEquals(2, $stringsExporterSetting->getId()); - $this->assertEquals('android', $stringsExporterSetting->getFormat()); - } - - public function testCreate() - { - $params = [ - 'format' => 'android', - "settings" => [ - "convertPlaceholders" => false - ] - ]; - - $this->mockRequest([ - 'path' => '/projects/2/strings-exporter-settings', - 'method' => 'post', - 'body' => $params, - 'response' => '{ + ); + + $stringsExporterSetting = $this->crowdin->stringsExporterSetting->get(2, 2); + + $this->assertInstanceOf(StringsExporterSetting::class, $stringsExporterSetting); + + $this->assertEquals(2, $stringsExporterSetting->getId()); + $this->assertEquals('android', $stringsExporterSetting->getFormat()); + } + + public function testCreate() + { + $params = [ + 'format' => 'android', + "settings" => [ + "convertPlaceholders" => false + ] + ]; + + $this->mockRequest([ + 'path' => '/projects/2/strings-exporter-settings', + 'method' => 'post', + 'body' => $params, + 'response' => '{ "data": { "id": 2, "format": "android", @@ -96,28 +96,28 @@ public function testCreate() "updatedAt": "2019-09-19T15:10:46+00:00" } }' - ]); + ]); - $stringsExporterSetting = $this->crowdin->stringsExporterSetting->create(2, $params); + $stringsExporterSetting = $this->crowdin->stringsExporterSetting->create(2, $params); - $this->assertInstanceOf(StringsExporterSetting::class, $stringsExporterSetting); - $this->assertEquals(2, $stringsExporterSetting->getId()); - $this->assertEquals('android', $stringsExporterSetting->getFormat()); - } + $this->assertInstanceOf(StringsExporterSetting::class, $stringsExporterSetting); + $this->assertEquals(2, $stringsExporterSetting->getId()); + $this->assertEquals('android', $stringsExporterSetting->getFormat()); + } - public function testDelete() - { - $this->mockRequest([ - 'path' => '/projects/2/strings-exporter-settings/2', - 'method' => 'delete', - ]); + public function testDelete() + { + $this->mockRequest([ + 'path' => '/projects/2/strings-exporter-settings/2', + 'method' => 'delete', + ]); - $this->crowdin->stringsExporterSetting->delete(2, 2); - } + $this->crowdin->stringsExporterSetting->delete(2, 2); + } - public function testGetAndUpdate() - { - $this->mockRequestGet('/projects/2/strings-exporter-settings/2', '{ + public function testGetAndUpdate() + { + $this->mockRequestGet('/projects/2/strings-exporter-settings/2', '{ "data": { "id": 2, "format": "android", @@ -129,15 +129,15 @@ public function testGetAndUpdate() } }'); - $stringsExporterSetting = $this->crowdin->stringsExporterSetting->get(2, 2); + $stringsExporterSetting = $this->crowdin->stringsExporterSetting->get(2, 2); - $this->assertInstanceOf(StringsExporterSetting::class, $stringsExporterSetting); - $this->assertEquals(2, $stringsExporterSetting->getId()); - $this->assertEquals('android', $stringsExporterSetting->getFormat()); + $this->assertInstanceOf(StringsExporterSetting::class, $stringsExporterSetting); + $this->assertEquals(2, $stringsExporterSetting->getId()); + $this->assertEquals('android', $stringsExporterSetting->getFormat()); - $stringsExporterSetting->setFormat('macosx'); + $stringsExporterSetting->setFormat('macosx'); - $this->mockRequestPath('/projects/2/strings-exporter-settings/2', '{ + $this->mockRequestPath('/projects/2/strings-exporter-settings/2', '{ "data": { "id": 2, "format": "macosx", @@ -149,9 +149,9 @@ public function testGetAndUpdate() } }'); - $stringsExporterSetting = $this->crowdin->stringsExporterSetting->update(2, $stringsExporterSetting); - $this->assertInstanceOf(StringsExporterSetting::class, $stringsExporterSetting); - $this->assertEquals(2, $stringsExporterSetting->getId()); - $this->assertEquals('macosx', $stringsExporterSetting->getFormat()); - } + $stringsExporterSetting = $this->crowdin->stringsExporterSetting->update(2, $stringsExporterSetting); + $this->assertInstanceOf(StringsExporterSetting::class, $stringsExporterSetting); + $this->assertEquals(2, $stringsExporterSetting->getId()); + $this->assertEquals('macosx', $stringsExporterSetting->getFormat()); + } } diff --git a/tests/CrowdinApiClient/Model/StringsExporterSettingTest.php b/tests/CrowdinApiClient/Model/StringsExporterSettingTest.php index 95819de8..5d9ef6e7 100644 --- a/tests/CrowdinApiClient/Model/StringsExporterSettingTest.php +++ b/tests/CrowdinApiClient/Model/StringsExporterSettingTest.php @@ -16,7 +16,7 @@ class StringsExporterSettingTest extends TestCase */ public $data = [ "id" => 2, - "format"=> "android" + "format" => "android" ]; /**