Skip to content

Commit 1db9357

Browse files
committed
Add test
1 parent 818b84c commit 1db9357

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

phpunit.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
<php>
2020
<env name="SHIPSTATION_TESTING" value="false"/>
2121
<env name="KEY" value=""/>
22+
<env name="PARTNER_KEY" value=""/>
2223
<env name="SECRET" value=""/>
2324
<env name="API_URL" value=""/>
2425
</php>

tests/ShipStationTest.php

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,12 @@ public function setUp()
2222
exit();
2323
}
2424

25-
$this->shipStation = new LaravelShipStation\ShipStation(getenv('KEY'), getenv('SECRET'), getenv('API_URL'));
25+
$this->shipStation = new LaravelShipStation\ShipStation(
26+
getenv('KEY'),
27+
getenv('SECRET'),
28+
getenv('API_URL'),
29+
getenv('PARTNER_KEY')
30+
);
2631
}
2732

2833
/** @test */
@@ -126,4 +131,19 @@ public function rate_limits_are_set_after_request()
126131
$this->assertGreaterThanOrEqual(0, $this->shipStation->getSecondsUntilReset());
127132
$this->assertInternalType('boolean', $this->shipStation->isRateLimited());
128133
}
134+
135+
/** @test */
136+
public function partner_api_key_header_is_set_when_defined()
137+
{
138+
if (empty(getenv('PARTNER_KEY'))) {
139+
// nothing to test
140+
return;
141+
}
142+
143+
$this->shipStation->webhooks->get();
144+
145+
$headers = $this->shipStation->request->getConfig('headers');
146+
147+
$this->assertArrayHasKey('x-partner', $headers);
148+
}
129149
}

0 commit comments

Comments
 (0)