apiClient = $this->createMock(EbayInventoryApiClient::class); $this->adapter = new EbayAdapter($this->apiClient); $this->article = new Article(new ArticleType('Notebook'), 'NB-001', 'INV-001', 1, ArticleCondition::Good); $this->article->setEbayTitle('Dell Latitude 5520'); $this->article->setListingPrice('299.00'); } public function test_get_type_returns_ebay(): void { $this->assertSame('ebay', $this->adapter->getType()); } public function test_publish_listing_calls_upsert_create_and_publish(): void { $this->apiClient->expects($this->once())->method('upsertInventoryItem'); $this->apiClient->expects($this->once())->method('createOffer')->willReturn('offer-123'); $this->apiClient->expects($this->once())->method('publishOffer')->with('offer-123')->willReturn('listing-456'); $listingId = $this->adapter->publishListing($this->article); $this->assertSame('listing-456', $listingId); } public function test_deactivate_listing_withdraws_offer(): void { $this->article->setEbayListingId('offer-123'); $this->apiClient->expects($this->once())->method('withdrawOffer')->with('offer-123'); $this->adapter->deactivateListing($this->article); } public function test_deactivate_listing_is_noop_when_no_listing_id(): void { $this->apiClient->expects($this->never())->method('withdrawOffer'); $this->adapter->deactivateListing($this->article); } }