mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-23 02:09:03 +02:00
Test availability of the info provider pages
This commit is contained in:
parent
f423fdf7f8
commit
4c1c6701b3
2 changed files with 34 additions and 2 deletions
|
@ -23,8 +23,15 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Services\InfoProviderSystem\Providers;
|
namespace App\Services\InfoProviderSystem\Providers;
|
||||||
|
|
||||||
|
use App\Services\InfoProviderSystem\DTOs\FileDTO;
|
||||||
use App\Services\InfoProviderSystem\DTOs\PartDetailDTO;
|
use App\Services\InfoProviderSystem\DTOs\PartDetailDTO;
|
||||||
|
use App\Services\InfoProviderSystem\DTOs\SearchResultDTO;
|
||||||
|
use Symfony\Component\DependencyInjection\Attribute\When;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is a provider, which is used during tests
|
||||||
|
*/
|
||||||
|
#[When(env: 'test')]
|
||||||
class TestProvider implements InfoProviderInterface
|
class TestProvider implements InfoProviderInterface
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -50,7 +57,11 @@ class TestProvider implements InfoProviderInterface
|
||||||
|
|
||||||
public function searchByKeyword(string $keyword): array
|
public function searchByKeyword(string $keyword): array
|
||||||
{
|
{
|
||||||
// TODO: Implement searchByKeyword() method.
|
return [
|
||||||
|
new SearchResultDTO(provider_key: $this->getProviderKey(), provider_id: 'element1', name: 'Element 1', description: 'fd'),
|
||||||
|
new SearchResultDTO(provider_key: $this->getProviderKey(), provider_id: 'element2', name: 'Element 2', description: 'fd'),
|
||||||
|
new SearchResultDTO(provider_key: $this->getProviderKey(), provider_id: 'element3', name: 'Element 3', description: 'fd'),
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCapabilities(): array
|
public function getCapabilities(): array
|
||||||
|
@ -63,6 +74,22 @@ class TestProvider implements InfoProviderInterface
|
||||||
|
|
||||||
public function getDetails(string $id): PartDetailDTO
|
public function getDetails(string $id): PartDetailDTO
|
||||||
{
|
{
|
||||||
// TODO: Implement getDetails() method.
|
return new PartDetailDTO(
|
||||||
|
provider_key: $this->getProviderKey(),
|
||||||
|
provider_id: $id,
|
||||||
|
name: 'Test Element',
|
||||||
|
description: 'fd',
|
||||||
|
manufacturer: 'Test Manufacturer',
|
||||||
|
mpn: '1234',
|
||||||
|
provider_url: 'https://invalid.invalid',
|
||||||
|
footprint: 'Footprint',
|
||||||
|
notes: 'Notes',
|
||||||
|
datasheets: [
|
||||||
|
new FileDTO('https://invalid.invalid/invalid.pdf', 'Datasheet')
|
||||||
|
],
|
||||||
|
images: [
|
||||||
|
new FileDTO('https://invalid.invalid/invalid.png', 'Image')
|
||||||
|
]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -140,5 +140,10 @@ class ApplicationAvailabilityFunctionalTest extends WebTestCase
|
||||||
yield ['/project/1/add_parts?parts=1,2'];
|
yield ['/project/1/add_parts?parts=1,2'];
|
||||||
yield ['/project/1/build?n=1'];
|
yield ['/project/1/build?n=1'];
|
||||||
yield ['/project/1/import_bom'];
|
yield ['/project/1/import_bom'];
|
||||||
|
|
||||||
|
//Test info provider system
|
||||||
|
yield ['/tools/info_providers/providers']; //List all providers
|
||||||
|
yield ['/tools/info_providers/search']; //Search page
|
||||||
|
yield ['/part/from_info_provider/test/element1/create']; //Create part from info provider
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue