-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BUGFIX] Correct API Responses (#474)
- Loading branch information
1 parent
124f6dd
commit 01e6a12
Showing
12 changed files
with
714 additions
and
170 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
194 changes: 194 additions & 0 deletions
194
tests/Functional/Controller/Api/MajorVersion/ReleaseControllerTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,194 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the package t3o/get.typo3.org. | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* For the full copyright and license information, please read the | ||
* LICENSE file that was distributed with this source code. | ||
* | ||
* The TYPO3 project - inspiring people to share! | ||
*/ | ||
|
||
namespace App\Tests\Functional\Controller\Api\MajorVersion; | ||
|
||
use App\DataFixtures\MajorVersionFixtures; | ||
use App\DataFixtures\ReleaseFixtures; | ||
use App\DataFixtures\RequirementFixtures; | ||
use App\Tests\Functional\Controller\Api\ApiCase; | ||
|
||
class ReleaseControllerTest extends ApiCase | ||
{ | ||
/** | ||
* @test | ||
*/ | ||
public function getReleasesByMajorVersionStructureTest(): void | ||
{ | ||
$this->addFixture(new MajorVersionFixtures()); | ||
$this->addFixture(new ReleaseFixtures()); | ||
$this->addFixture(new RequirementFixtures()); | ||
$this->executeFixtures(); | ||
|
||
$this->client->request('GET', '/api/v1/major/10/release/'); | ||
|
||
$response = $this->client->getResponse(); | ||
$responseContent = json_decode((string)$response->getContent(), true, 512, JSON_THROW_ON_ERROR); | ||
|
||
self::assertIsArray($responseContent); | ||
$this->assertArrayStructure( | ||
[ | ||
[ | ||
'version' => 'string', | ||
'date' => 'datetime', | ||
'type' => 'string', | ||
'elts' => 'boolean', | ||
'tar_package' => [ | ||
'?md5sum' => 'string', | ||
'?sha1sum' => 'string', | ||
'?sha256sum' => 'string', | ||
], | ||
'zip_package' => [ | ||
'?md5sum' => 'string', | ||
'?sha1sum' => 'string', | ||
'?sha256sum' => 'string', | ||
], | ||
], | ||
], | ||
$responseContent | ||
); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function getLatestReleaseByMajorVersionStructureTest(): void | ||
{ | ||
$this->addFixture(new MajorVersionFixtures()); | ||
$this->addFixture(new ReleaseFixtures()); | ||
$this->addFixture(new RequirementFixtures()); | ||
$this->executeFixtures(); | ||
|
||
$this->client->request('GET', '/api/v1/major/10/release/latest'); | ||
|
||
$response = $this->client->getResponse(); | ||
$responseContent = json_decode((string)$response->getContent(), true, 512, JSON_THROW_ON_ERROR); | ||
|
||
self::assertIsArray($responseContent); | ||
$this->assertArrayStructure( | ||
[ | ||
'version' => 'string', | ||
'date' => 'datetime', | ||
'type' => 'string', | ||
'elts' => 'boolean', | ||
'tar_package' => [ | ||
'?md5sum' => 'string', | ||
'?sha1sum' => 'string', | ||
'?sha256sum' => 'string', | ||
], | ||
'zip_package' => [ | ||
'?md5sum' => 'string', | ||
'?sha1sum' => 'string', | ||
'?sha256sum' => 'string', | ||
], | ||
], | ||
$responseContent | ||
); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function getLatestSecurityReleaseByMajorVersionStructureTest(): void | ||
{ | ||
$this->addFixture(new MajorVersionFixtures()); | ||
$this->addFixture(new ReleaseFixtures()); | ||
$this->addFixture(new RequirementFixtures()); | ||
$this->executeFixtures(); | ||
|
||
$this->client->request('GET', '/api/v1/major/10/release/latest/security'); | ||
|
||
$response = $this->client->getResponse(); | ||
$responseContent = json_decode((string)$response->getContent(), true, 512, JSON_THROW_ON_ERROR); | ||
|
||
self::assertIsArray($responseContent); | ||
$this->assertArrayStructure( | ||
[ | ||
'version' => 'string', | ||
'date' => 'datetime', | ||
'type' => 'string', | ||
'elts' => 'boolean', | ||
'tar_package' => [ | ||
'?md5sum' => 'string', | ||
'?sha1sum' => 'string', | ||
'?sha256sum' => 'string', | ||
], | ||
'zip_package' => [ | ||
'?md5sum' => 'string', | ||
'?sha1sum' => 'string', | ||
'?sha256sum' => 'string', | ||
], | ||
], | ||
$responseContent | ||
); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function getLatestReleaseContentByMajorVersionStructureTest(): void | ||
{ | ||
$this->addFixture(new MajorVersionFixtures()); | ||
$this->addFixture(new ReleaseFixtures()); | ||
$this->addFixture(new RequirementFixtures()); | ||
$this->executeFixtures(); | ||
|
||
$this->client->request('GET', '/api/v1/major/10/release/latest/content'); | ||
|
||
$response = $this->client->getResponse(); | ||
$responseContent = json_decode((string)$response->getContent(), true, 512, JSON_THROW_ON_ERROR); | ||
|
||
self::assertIsArray($responseContent); | ||
$this->assertArrayStructure( | ||
[ | ||
'version' => 'string', | ||
'date' => 'datetime', | ||
'elts' => 'boolean', | ||
'release_notes' => [ | ||
'news_link' => 'string', | ||
'news' => 'string', | ||
'upgrading_instructions' => 'string', | ||
'changes' => 'string', | ||
'?legacy_content' => 'string', | ||
], | ||
'?checksums' => [ | ||
'tar' => [ | ||
'?sha1' => 'string', | ||
'?md5' => 'string', | ||
'?sha256' => 'string', | ||
], | ||
'zip' => [ | ||
'?sha1' => 'string', | ||
'?md5' => 'string', | ||
'?sha256' => 'string', | ||
], | ||
], | ||
'?urls' => [ | ||
'tar' => 'string', | ||
'zip' => 'string', | ||
], | ||
], | ||
$responseContent | ||
); | ||
} | ||
} |
Oops, something went wrong.