/** * Tests that two API requests don't send the same order ID and merchant * reference. This was the case when users doubleclicked and we were * using the last 5 digits of time in seconds as a suffix. We want to see * what happens when a 2nd request comes in while the 1st is still waiting * for a CURL response, so here we fake that situation by having CURL throw * an exception during the 1st response. */ public function testNoDupeOrderId() { $this->setUpRequest(array('action' => 'donate', 'amount' => '3.00', 'card_type' => 'amex', 'city' => 'Hollywood', 'contribution_tracking_id' => '22901382', 'country' => 'US', 'currency_code' => 'USD', 'email' => '*****@*****.**', 'fname' => 'Fakety', 'format' => 'json', 'gateway' => 'globalcollect', 'language' => 'en', 'lname' => 'Fake', 'payment_method' => 'cc', 'referrer' => 'http://en.wikipedia.org/wiki/Main_Page', 'state' => 'MA', 'street' => '99 Fake St', 'utm_campaign' => 'C14_en5C_dec_dsk_FR', 'utm_medium' => 'sitenotice', 'utm_source' => 'B14_120921_5C_lg_fnt_sans.no-LP.cc', 'zip' => '90210')); $gateway = new TestingGlobalCollectAdapter(array('api_request' => 'true')); $gateway->setDummyGatewayResponseCode('Exception'); try { $gateway->do_transaction('INSERT_ORDERWITHPAYMENT'); } catch (Exception $e) { // totally expected this } $first = $gateway->curled[0]; //simulate another request coming in before we get anything back from GC $anotherGateway = new TestingGlobalCollectAdapter(array('api_request' => 'true')); $anotherGateway->do_transaction('INSERT_ORDERWITHPAYMENT'); $second = $anotherGateway->curled[0]; $this->assertFalse($first == $second, 'Two calls to the api did the same thing'); }