mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-01-14 06:09:33 +00:00
Merge branch 'master' into feature/automatic-ipn-generation
This commit is contained in:
commit
7a144d31c6
153 changed files with 18678 additions and 1739 deletions
69
tests/API/Endpoints/PartCustomStateEndpointTest.php
Normal file
69
tests/API/Endpoints/PartCustomStateEndpointTest.php
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
<?php
|
||||
/*
|
||||
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
|
||||
*
|
||||
* Copyright (C) 2019 - 2024 Jan Böhmer (https://github.com/jbtronics)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published
|
||||
* by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
|
||||
namespace App\Tests\API\Endpoints;
|
||||
|
||||
class PartCustomStateEndpointTest extends CrudEndpointTestCase
|
||||
{
|
||||
|
||||
protected function getBasePath(): string
|
||||
{
|
||||
return '/api/part_custom_states';
|
||||
}
|
||||
|
||||
public function testGetCollection(): void
|
||||
{
|
||||
$this->_testGetCollection();
|
||||
self::assertJsonContains([
|
||||
'hydra:totalItems' => 7,
|
||||
]);
|
||||
}
|
||||
|
||||
public function testGetItem(): void
|
||||
{
|
||||
$this->_testGetItem(1);
|
||||
$this->_testGetItem(2);
|
||||
$this->_testGetItem(3);
|
||||
}
|
||||
|
||||
public function testCreateItem(): void
|
||||
{
|
||||
$this->_testPostItem([
|
||||
'name' => 'Test API',
|
||||
'parent' => '/api/part_custom_states/1',
|
||||
]);
|
||||
}
|
||||
|
||||
public function testUpdateItem(): void
|
||||
{
|
||||
$this->_testPatchItem(5, [
|
||||
'name' => 'Updated',
|
||||
'parent' => '/api/part_custom_states/2',
|
||||
]);
|
||||
}
|
||||
|
||||
public function testDeleteItem(): void
|
||||
{
|
||||
$this->_testDeleteItem(4);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
|
||||
*
|
||||
* Copyright (C) 2019 - 2020 Jan Böhmer (https://github.com/jbtronics)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published
|
||||
* by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Tests\Controller\AdminPages;
|
||||
|
||||
use App\Entity\Parts\PartCustomState;
|
||||
use PHPUnit\Framework\Attributes\Group;
|
||||
|
||||
#[Group('slow')]
|
||||
#[Group('DB')]
|
||||
class PartCustomStateControllerTest extends AbstractAdminController
|
||||
{
|
||||
protected static string $base_path = '/en/part_custom_state';
|
||||
protected static string $entity_class = PartCustomState::class;
|
||||
}
|
||||
|
|
@ -29,6 +29,7 @@ use App\Entity\Attachments\AttachmentType;
|
|||
use App\Entity\Attachments\AttachmentTypeAttachment;
|
||||
use App\Entity\Attachments\CategoryAttachment;
|
||||
use App\Entity\Attachments\CurrencyAttachment;
|
||||
use App\Entity\Attachments\PartCustomStateAttachment;
|
||||
use App\Entity\Attachments\ProjectAttachment;
|
||||
use App\Entity\Attachments\FootprintAttachment;
|
||||
use App\Entity\Attachments\GroupAttachment;
|
||||
|
|
@ -38,6 +39,7 @@ use App\Entity\Attachments\PartAttachment;
|
|||
use App\Entity\Attachments\StorageLocationAttachment;
|
||||
use App\Entity\Attachments\SupplierAttachment;
|
||||
use App\Entity\Attachments\UserAttachment;
|
||||
use App\Entity\Parts\PartCustomState;
|
||||
use App\Entity\ProjectSystem\Project;
|
||||
use App\Entity\Parts\Category;
|
||||
use App\Entity\Parts\Footprint;
|
||||
|
|
@ -86,6 +88,7 @@ class AttachmentTest extends TestCase
|
|||
yield [ManufacturerAttachment::class, Manufacturer::class];
|
||||
yield [MeasurementUnitAttachment::class, MeasurementUnit::class];
|
||||
yield [PartAttachment::class, Part::class];
|
||||
yield [PartCustomStateAttachment::class, PartCustomState::class];
|
||||
yield [StorageLocationAttachment::class, StorageLocation::class];
|
||||
yield [SupplierAttachment::class, Supplier::class];
|
||||
yield [UserAttachment::class, User::class];
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ use App\Entity\Parts\Manufacturer;
|
|||
use App\Entity\Parts\MeasurementUnit;
|
||||
use App\Entity\Parts\Part;
|
||||
use App\Entity\Parts\PartAssociation;
|
||||
use App\Entity\Parts\PartCustomState;
|
||||
use App\Entity\Parts\PartLot;
|
||||
use App\Entity\PriceInformations\Orderdetail;
|
||||
use App\Services\EntityMergers\Mergers\PartMerger;
|
||||
|
|
@ -54,6 +55,7 @@ class PartMergerTest extends KernelTestCase
|
|||
$manufacturer1 = new Manufacturer();
|
||||
$manufacturer2 = new Manufacturer();
|
||||
$unit = new MeasurementUnit();
|
||||
$customState = new PartCustomState();
|
||||
|
||||
$part1 = (new Part())
|
||||
->setCategory($category)
|
||||
|
|
@ -62,7 +64,8 @@ class PartMergerTest extends KernelTestCase
|
|||
$part2 = (new Part())
|
||||
->setFootprint($footprint)
|
||||
->setManufacturer($manufacturer2)
|
||||
->setPartUnit($unit);
|
||||
->setPartUnit($unit)
|
||||
->setPartCustomState($customState);
|
||||
|
||||
$merged = $this->merger->merge($part1, $part2);
|
||||
$this->assertSame($merged, $part1);
|
||||
|
|
@ -70,6 +73,7 @@ class PartMergerTest extends KernelTestCase
|
|||
$this->assertSame($footprint, $merged->getFootprint());
|
||||
$this->assertSame($manufacturer1, $merged->getManufacturer());
|
||||
$this->assertSame($unit, $merged->getPartUnit());
|
||||
$this->assertSame($customState, $merged->getPartCustomState());
|
||||
}
|
||||
|
||||
public function testMergeOfTags(): void
|
||||
|
|
|
|||
|
|
@ -114,4 +114,22 @@ class ProjectBuildHelperTest extends WebTestCase
|
|||
$this->assertSame(0, $this->service->getMaximumBuildableCount($project));
|
||||
|
||||
}
|
||||
|
||||
public function testGetMaximumBuildableCountEmpty(): void
|
||||
{
|
||||
$project = new Project();
|
||||
|
||||
$this->assertSame(0, $this->service->getMaximumBuildableCount($project));
|
||||
}
|
||||
|
||||
public function testGetMaximumBuildableCountAsString(): void
|
||||
{
|
||||
$project = new Project();
|
||||
$bom_entry1 = new ProjectBOMEntry();
|
||||
$bom_entry1->setName("Test");
|
||||
$project->addBomEntry($bom_entry1);
|
||||
|
||||
$this->assertSame('∞', $this->service->getMaximumBuildableCountAsString($project));
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ declare(strict_types=1);
|
|||
namespace App\Tests\Twig;
|
||||
|
||||
use App\Entity\Attachments\PartAttachment;
|
||||
use App\Entity\Parts\PartCustomState;
|
||||
use App\Entity\ProjectSystem\Project;
|
||||
use App\Entity\LabelSystem\LabelProfile;
|
||||
use App\Entity\Parts\Category;
|
||||
|
|
@ -67,6 +68,7 @@ class EntityExtensionTest extends WebTestCase
|
|||
$this->assertSame('currency', $this->service->getEntityType(new Currency()));
|
||||
$this->assertSame('measurement_unit', $this->service->getEntityType(new MeasurementUnit()));
|
||||
$this->assertSame('label_profile', $this->service->getEntityType(new LabelProfile()));
|
||||
$this->assertSame('part_custom_state', $this->service->getEntityType(new PartCustomState()));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7437,11 +7437,13 @@
|
|||
<field Field="lowStock" Type="tinyint(1)" Null="NO" Key="" Extra="" Comment="" />
|
||||
<field Field="metaPart" Type="tinyint(1)" Null="NO" Key="" Default="0" Extra="" Comment="" />
|
||||
<field Field="partUnit_id" Type="int(11)" Null="YES" Key="MUL" Default="NULL" Extra="" Comment="" />
|
||||
<field Field="partCustomState_id" Type="int(11)" Null="YES" Key="MUL" Default="NULL" Extra="" Comment="" />
|
||||
<field Field="storageLocation_id" Type="int(11)" Null="YES" Key="MUL" Default="NULL" Extra="" Comment="" />
|
||||
<key Table="part" Non_unique="0" Key_name="PRIMARY" Seq_in_index="1" Column_name="id" Collation="A" Cardinality="3" Null="" Index_type="BTREE" Comment="" Index_comment="" Ignored="NO" />
|
||||
<key Table="part" Non_unique="1" Key_name="IDX_E93DDFF812469DE2" Seq_in_index="1" Column_name="category_id" Collation="A" Cardinality="3" Null="YES" Index_type="BTREE" Comment="" Index_comment="" Ignored="NO" />
|
||||
<key Table="part" Non_unique="1" Key_name="IDX_E93DDFF851364C98" Seq_in_index="1" Column_name="footprint_id" Collation="A" Cardinality="3" Null="YES" Index_type="BTREE" Comment="" Index_comment="" Ignored="NO" />
|
||||
<key Table="part" Non_unique="1" Key_name="IDX_E93DDFF8F7A36E87" Seq_in_index="1" Column_name="partUnit_id" Collation="A" Cardinality="3" Null="YES" Index_type="BTREE" Comment="" Index_comment="" Ignored="NO" />
|
||||
<key Table="part" Non_unique="1" Key_name="IDX_E93DDFF8F7A36E88" Seq_in_index="1" Column_name="partCustomState_id" Collation="A" Cardinality="3" Null="YES" Index_type="BTREE" Comment="" Index_comment="" Ignored="NO" />
|
||||
<key Table="part" Non_unique="1" Key_name="IDX_E93DDFF873CD58AF" Seq_in_index="1" Column_name="storageLocation_id" Collation="A" Cardinality="3" Null="YES" Index_type="BTREE" Comment="" Index_comment="" Ignored="NO" />
|
||||
<options Name="part" Engine="InnoDB" Version="10" Row_format="Dynamic" Rows="3" Avg_row_length="5461" Data_length="16384" Max_data_length="0" Index_length="65536" Data_free="0" Auto_increment="4" Create_time="2023-03-22 22:28:36" Update_time="2023-03-22 22:40:40" Collation="utf8mb3_unicode_ci" Create_options="" Comment="" Max_index_length="0" Temporary="N" />
|
||||
</table_structure>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue