public function testBatchCancel() { $batch_api = $this->api->start_batch(); $data = array('segment' => 'Batch Updated Customer'); for ($i = 1; $i <= 10; $i++) { $result = $batch_api->create_customer(sprintf('*****@*****.**', $i), $data); $this->assertTrue($result->success); $this->assertEquals('Batched', $result->status); $this->assertEquals($i, $batch_api->command_length()); } $result = $batch_api->cancel(); $this->assertTrue($result->success); $this->assertEquals('Canceled', $result->status); $this->assertEquals(0, $batch_api->command_length()); }