mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-07-27 03:31:35 +00:00
Fixed phpunit tests
Some checks failed
Build assets artifact / Build assets artifact (push) Has been cancelled
Docker Image Build / build (linux/amd64, amd64, ubuntu-latest) (push) Has been cancelled
Docker Image Build / build (linux/arm/v7, armv7, ubuntu-24.04-arm) (push) Has been cancelled
Docker Image Build / build (linux/arm64, arm64, ubuntu-24.04-arm) (push) Has been cancelled
Docker Image Build (FrankenPHP) / build (linux/amd64, amd64, ubuntu-latest) (push) Has been cancelled
Docker Image Build (FrankenPHP) / build (linux/arm/v7, armv7, ubuntu-24.04-arm) (push) Has been cancelled
Docker Image Build (FrankenPHP) / build (linux/arm64, arm64, ubuntu-24.04-arm) (push) Has been cancelled
Static analysis / Static analysis (push) Has been cancelled
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.2, mysql) (push) Has been cancelled
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.3, mysql) (push) Has been cancelled
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.4, mysql) (push) Has been cancelled
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.5, mysql) (push) Has been cancelled
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.2, postgres) (push) Has been cancelled
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.3, postgres) (push) Has been cancelled
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.4, postgres) (push) Has been cancelled
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.5, postgres) (push) Has been cancelled
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.2, sqlite) (push) Has been cancelled
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.3, sqlite) (push) Has been cancelled
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.4, sqlite) (push) Has been cancelled
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.5, sqlite) (push) Has been cancelled
Docker Image Build / merge (push) Has been cancelled
Docker Image Build (FrankenPHP) / merge (push) Has been cancelled
Some checks failed
Build assets artifact / Build assets artifact (push) Has been cancelled
Docker Image Build / build (linux/amd64, amd64, ubuntu-latest) (push) Has been cancelled
Docker Image Build / build (linux/arm/v7, armv7, ubuntu-24.04-arm) (push) Has been cancelled
Docker Image Build / build (linux/arm64, arm64, ubuntu-24.04-arm) (push) Has been cancelled
Docker Image Build (FrankenPHP) / build (linux/amd64, amd64, ubuntu-latest) (push) Has been cancelled
Docker Image Build (FrankenPHP) / build (linux/arm/v7, armv7, ubuntu-24.04-arm) (push) Has been cancelled
Docker Image Build (FrankenPHP) / build (linux/arm64, arm64, ubuntu-24.04-arm) (push) Has been cancelled
Static analysis / Static analysis (push) Has been cancelled
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.2, mysql) (push) Has been cancelled
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.3, mysql) (push) Has been cancelled
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.4, mysql) (push) Has been cancelled
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.5, mysql) (push) Has been cancelled
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.2, postgres) (push) Has been cancelled
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.3, postgres) (push) Has been cancelled
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.4, postgres) (push) Has been cancelled
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.5, postgres) (push) Has been cancelled
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.2, sqlite) (push) Has been cancelled
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.3, sqlite) (push) Has been cancelled
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.4, sqlite) (push) Has been cancelled
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.5, sqlite) (push) Has been cancelled
Docker Image Build / merge (push) Has been cancelled
Docker Image Build (FrankenPHP) / merge (push) Has been cancelled
This commit is contained in:
parent
07d106e44d
commit
12b53f15ba
1 changed files with 17 additions and 62 deletions
|
|
@ -133,25 +133,21 @@ final class LCSCProviderTest extends TestCase
|
|||
{
|
||||
$mockResponse = new MockResponse(json_encode([
|
||||
'result' => [
|
||||
'productSearchResultVO' => [
|
||||
'productList' => [
|
||||
[
|
||||
'productCode' => 'C789012',
|
||||
'productModel' => 'Regular Component',
|
||||
'productIntroEn' => 'Regular description',
|
||||
'brandNameEn' => 'Regular Manufacturer',
|
||||
'encapStandard' => '0805',
|
||||
'productImageUrl' => 'https://example.com/regular.jpg',
|
||||
'productImages' => ['https://example.com/regular1.jpg'],
|
||||
'productPriceList' => [
|
||||
['ladder' => 10, 'productPrice' => '0.08', 'currencySymbol' => '€']
|
||||
],
|
||||
'paramVOList' => [],
|
||||
'pdfUrl' => null,
|
||||
'weight' => null
|
||||
]
|
||||
]
|
||||
]
|
||||
'exactMatchResult' => [[
|
||||
'productCode' => 'C789012',
|
||||
'productModel' => 'Regular Component',
|
||||
'productIntroEn' => 'Regular description',
|
||||
'brandNameEn' => 'Regular Manufacturer',
|
||||
'encapStandard' => '0805',
|
||||
'productImageUrl' => 'https://example.com/regular.jpg',
|
||||
'productImages' => ['https://example.com/regular1.jpg'],
|
||||
'productPriceList' => [
|
||||
['ladder' => 10, 'productPrice' => '0.08', 'currencySymbol' => '€']
|
||||
],
|
||||
'paramVOList' => [],
|
||||
'pdfUrl' => null,
|
||||
'weight' => null
|
||||
]]
|
||||
]
|
||||
]));
|
||||
|
||||
|
|
@ -166,45 +162,6 @@ final class LCSCProviderTest extends TestCase
|
|||
$this->assertSame('Regular Component', $results[0]->name);
|
||||
}
|
||||
|
||||
public function testSearchByKeywordWithTipProduct(): void
|
||||
{
|
||||
$mockResponse = new MockResponse(json_encode([
|
||||
'result' => [
|
||||
'productSearchResultVO' => [
|
||||
'productList' => []
|
||||
],
|
||||
'tipProductDetailUrlVO' => [
|
||||
'productCode' => 'C555555'
|
||||
]
|
||||
]
|
||||
]));
|
||||
|
||||
$detailResponse = new MockResponse(json_encode([
|
||||
'result' => [
|
||||
'productCode' => 'C555555',
|
||||
'productModel' => 'Tip Component',
|
||||
'productIntroEn' => 'Tip description',
|
||||
'brandNameEn' => 'Tip Manufacturer',
|
||||
'encapStandard' => '1206',
|
||||
'productImageUrl' => null,
|
||||
'productImages' => [],
|
||||
'productPriceList' => [],
|
||||
'paramVOList' => [],
|
||||
'pdfUrl' => null,
|
||||
'weight' => null
|
||||
]
|
||||
]));
|
||||
|
||||
$this->httpClient->setResponseFactory([$mockResponse, $detailResponse]);
|
||||
|
||||
$results = $this->provider->searchByKeyword('special');
|
||||
|
||||
$this->assertIsArray($results);
|
||||
$this->assertCount(1, $results);
|
||||
$this->assertInstanceOf(PartDetailDTO::class, $results[0]);
|
||||
$this->assertSame('C555555', $results[0]->provider_id);
|
||||
$this->assertSame('Tip Component', $results[0]->name);
|
||||
}
|
||||
|
||||
public function testSearchByKeywordsBatch(): void
|
||||
{
|
||||
|
|
@ -310,7 +267,7 @@ final class LCSCProviderTest extends TestCase
|
|||
]
|
||||
]));
|
||||
|
||||
$this->httpClient->setResponseFactory([$mockResponse]);
|
||||
$this->httpClient->setResponseFactory([$mockResponse, $mockResponse]);
|
||||
|
||||
$this->expectException(\RuntimeException::class);
|
||||
$this->expectExceptionMessage('No part found with ID INVALID');
|
||||
|
|
@ -322,8 +279,7 @@ final class LCSCProviderTest extends TestCase
|
|||
{
|
||||
$mockResponse = new MockResponse(json_encode([
|
||||
'result' => [
|
||||
'productSearchResultVO' => [
|
||||
'productList' => [
|
||||
'exactMatchResult' => [
|
||||
[
|
||||
'productCode' => 'C123456',
|
||||
'productModel' => 'Component 1',
|
||||
|
|
@ -350,7 +306,6 @@ final class LCSCProviderTest extends TestCase
|
|||
'pdfUrl' => null,
|
||||
'weight' => null
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
]));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue