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

This commit is contained in:
Jan Böhmer 2026-07-20 00:04:55 +02:00
parent 07d106e44d
commit 12b53f15ba

View file

@ -133,9 +133,7 @@ final class LCSCProviderTest extends TestCase
{ {
$mockResponse = new MockResponse(json_encode([ $mockResponse = new MockResponse(json_encode([
'result' => [ 'result' => [
'productSearchResultVO' => [ 'exactMatchResult' => [[
'productList' => [
[
'productCode' => 'C789012', 'productCode' => 'C789012',
'productModel' => 'Regular Component', 'productModel' => 'Regular Component',
'productIntroEn' => 'Regular description', 'productIntroEn' => 'Regular description',
@ -149,9 +147,7 @@ final class LCSCProviderTest extends TestCase
'paramVOList' => [], 'paramVOList' => [],
'pdfUrl' => null, 'pdfUrl' => null,
'weight' => null 'weight' => null
] ]]
]
]
] ]
])); ]));
@ -166,45 +162,6 @@ final class LCSCProviderTest extends TestCase
$this->assertSame('Regular Component', $results[0]->name); $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 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->expectException(\RuntimeException::class);
$this->expectExceptionMessage('No part found with ID INVALID'); $this->expectExceptionMessage('No part found with ID INVALID');
@ -322,8 +279,7 @@ final class LCSCProviderTest extends TestCase
{ {
$mockResponse = new MockResponse(json_encode([ $mockResponse = new MockResponse(json_encode([
'result' => [ 'result' => [
'productSearchResultVO' => [ 'exactMatchResult' => [
'productList' => [
[ [
'productCode' => 'C123456', 'productCode' => 'C123456',
'productModel' => 'Component 1', 'productModel' => 'Component 1',
@ -352,7 +308,6 @@ final class LCSCProviderTest extends TestCase
] ]
] ]
] ]
]
])); ]));
$this->httpClient->setResponseFactory([$mockResponse]); $this->httpClient->setResponseFactory([$mockResponse]);