Skip to content

Commit

Permalink
UBR-353 Add test for cancelTicketById and drop the return.
Browse files Browse the repository at this point in the history
  • Loading branch information
HnLn committed Nov 19, 2015
1 parent b5ebd28 commit 10feaff
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 14 deletions.
1 change: 0 additions & 1 deletion CultureFeed/CultureFeed/Uitpas.php
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,6 @@ public function cancelTicketSale($uitpas_number, $cdbid, $consumer_key_counter =
*
* @param string $ticketId The ticket id
* @param string $consumer_key_counter The consumer key of the counter from where the request originates
* @return boolean
*/
public function cancelTicketSaleById($ticketId, $consumer_key_counter = NULL);

Expand Down
20 changes: 7 additions & 13 deletions CultureFeed/CultureFeed/Uitpas/Default.php
Original file line number Diff line number Diff line change
Expand Up @@ -996,19 +996,13 @@ public function cancelTicketSale($uitpas_number, $cdbid, $consumer_key_counter =
*/
public function cancelTicketSaleById($ticketId, $consumer_key_counter = NULL)
{
$data = array();

if ($consumer_key_counter) {
$data['balieConsumerKey'] = $consumer_key_counter;
}

try {
$this->oauth_client->authenticatedPostAsXml('uitpas/cultureevent/cancel/' . $ticketId, $data);
return true;
}
catch (Exception $e) {
return false;
}
$data = array();

if ($consumer_key_counter) {
$data['balieConsumerKey'] = $consumer_key_counter;
}

$this->oauth_client->authenticatedPostAsXml('uitpas/cultureevent/cancel/' . $ticketId, $data);
}

public function getPassholderForTicketSale( CultureFeed_Uitpas_Event_TicketSale $ts, $consumer_key_counter = NULL ) {
Expand Down
21 changes: 21 additions & 0 deletions CultureFeed/test/uitpas/CultureFeed_Uitpas_TicketSalesTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

class CultureFeed_Uitpas_TicketSaleTest extends PHPUnit_Framework_TestCase {

/**
* @test
*/
public function testCancelTicketSaleById() {
$oauth_client_stub = $this->getMock('CultureFeed_OAuthClient');
$ticketId = 1;
$consumerKey = 'abc';
$data = array('balieConsumerKey' => $consumerKey);

$oauth_client_stub->expects($this->once())
->method('authenticatedPostAsXml')
->with('uitpas/cultureevent/cancel/' . $ticketId, $data);

$cf = new CultureFeed($oauth_client_stub);
$cf->uitpas()->cancelTicketSaleById($ticketId, $consumerKey);
}
}

0 comments on commit 10feaff

Please sign in to comment.