|
| 1 | +<?php |
| 2 | +/* |
| 3 | + * This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). |
| 4 | + * |
| 5 | + * Copyright (C) 2019 - 2024 Jan Böhmer (https://github.com/jbtronics) |
| 6 | + * |
| 7 | + * This program is free software: you can redistribute it and/or modify |
| 8 | + * it under the terms of the GNU Affero General Public License as published |
| 9 | + * by the Free Software Foundation, either version 3 of the License, or |
| 10 | + * (at your option) any later version. |
| 11 | + * |
| 12 | + * This program is distributed in the hope that it will be useful, |
| 13 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | + * GNU Affero General Public License for more details. |
| 16 | + * |
| 17 | + * You should have received a copy of the GNU Affero General Public License |
| 18 | + * along with this program. If not, see <https://www.gnu.org/licenses/>. |
| 19 | + */ |
| 20 | + |
| 21 | +declare(strict_types=1); |
| 22 | + |
| 23 | + |
| 24 | +namespace App\Tests\API\Endpoints; |
| 25 | + |
| 26 | +class PartCustomStateEndpointTest extends CrudEndpointTestCase |
| 27 | +{ |
| 28 | + |
| 29 | + protected function getBasePath(): string |
| 30 | + { |
| 31 | + return '/api/part_custom_states'; |
| 32 | + } |
| 33 | + |
| 34 | + public function testGetCollection(): void |
| 35 | + { |
| 36 | + $this->_testGetCollection(); |
| 37 | + self::assertJsonContains([ |
| 38 | + 'hydra:totalItems' => 7, |
| 39 | + ]); |
| 40 | + } |
| 41 | + |
| 42 | + public function testGetItem(): void |
| 43 | + { |
| 44 | + $this->_testGetItem(1); |
| 45 | + $this->_testGetItem(2); |
| 46 | + $this->_testGetItem(3); |
| 47 | + } |
| 48 | + |
| 49 | + public function testCreateItem(): void |
| 50 | + { |
| 51 | + $this->_testPostItem([ |
| 52 | + 'name' => 'Test API', |
| 53 | + 'parent' => '/api/part_custom_states/1', |
| 54 | + ]); |
| 55 | + } |
| 56 | + |
| 57 | + public function testUpdateItem(): void |
| 58 | + { |
| 59 | + $this->_testPatchItem(5, [ |
| 60 | + 'name' => 'Updated', |
| 61 | + 'parent' => '/api/part_custom_states/2', |
| 62 | + ]); |
| 63 | + } |
| 64 | + |
| 65 | + public function testDeleteItem(): void |
| 66 | + { |
| 67 | + $this->_testDeleteItem(4); |
| 68 | + } |
| 69 | +} |
0 commit comments