Inheritance: extends TestCase, use trait Illuminate\Foundation\Testing\DatabaseTransactions
Esempio n. 1
0
 /** @test */
 public function itShouldReturnDecrementedValue()
 {
     list(, $mc) = $this->getClient();
     $map = [['item.dec', 1, 0], ['item.fails', 1, false]];
     $mc->expects($this->any())->method('decrement')->will($this->returnValueMap($map));
     return ClientTest::itShouldReturnDecrementedValue();
 }
Esempio n. 2
0
 public function testDocsExample()
 {
     $api = ClientTest::getInstance();
     $res = $api->getSalesTax()->where(array(\TaxJar\Api\Common\Fields::AMOUNT => "10.00", \TaxJar\Api\Common\Fields::SHIPPING => "2.00", \TaxJar\Api\Common\Fields::FROM_CITY => "Ramsey", \TaxJar\Api\Common\Fields::FROM_STATE => "NJ", \TaxJar\Api\Common\Fields::FROM_ZIP => "07446", \TaxJar\Api\Common\Fields::FROM_COUNTRY => "US", \TaxJar\Api\Common\Fields::TO_CITY => "Freehold", \TaxJar\Api\Common\Fields::TO_STATE => "NJ", \TaxJar\Api\Common\Fields::TO_ZIP => "07728", \TaxJar\Api\Common\Fields::TO_COUNTRY => "US"))->execute();
     $this->assertNotEmpty($res);
     $this->assertInstanceOf("TaxJar\\Api\\Response", $res);
     $this->assertEquals(\TaxJar\Api\Response::HTTP_OK, $res->status);
     $this->assertNotEmpty($res->data);
     $this->assertArrayHasKey('amount_to_collect', $res->data);
     $this->assertArrayHasKey('rate', $res->data);
     $this->assertArrayHasKey('has_nexus', $res->data);
     $this->assertArrayHasKey('freight_taxable', $res->data);
     $this->assertArrayHasKey('tax_source', $res->data);
 }
Esempio n. 3
0
 public function testZipCityCountryCanada()
 {
     $api = ClientTest::getInstance();
     $res = $api->getTaxRate("N8W1Y3", "ON", "CA")->execute();
     $this->assertNotEmpty($res);
     $this->assertInstanceOf("TaxJar\\Api\\Response", $res);
     $this->assertEquals(\TaxJar\Api\Response::HTTP_OK, $res->status);
     $this->assertNotEmpty($res->data);
     $this->assertArrayHasKey('location', $res->data);
     $this->assertNotEmpty($res->data);
     $this->assertArrayHasKey('combined_rate', $res->data['location']);
     $this->assertEquals('Windsor', $res->data['location']['city']);
     $this->assertGreaterThan(0, $res->data['location']['combined_rate']);
 }