Advertisement
Guest User

Untitled

a guest
May 19th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.14 KB | None | 0 0
  1. <?php
  2.  
  3. namespace tests\Integration\API\AdminPanel;
  4.  
  5. use App\AdminPanel\Events\EventsHandler;
  6. use DB;
  7. use tests\Integration\AutoPricer\IntegrationTestCase;
  8.  
  9. class EventsHandlerTest extends IntegrationTestCase
  10. {
  11. /* @var PDO */
  12. private $db;
  13. /* @var EventsHandler */
  14. private $service;
  15. private $bg_event_id_to_map;
  16. private $event_exchange_id = 11111;
  17. private $exchange_id = 1;
  18. private $unresolveable_exchange_id = 2;
  19. private $admin_user_id = 1;
  20.  
  21. public function setUp()
  22. {
  23. parent::setUp();
  24. $this->db = DB::getPdo();
  25. $this->service = new EventsHandler();
  26. $this->bg_event_id_to_map = $this->addEvent();
  27. }
  28.  
  29. private function addEvent() {
  30. $sql = <<<SQL
  31. INSERT INTO `bg_events` VALUES (1,'98989898',NULL,'Texas Rangers at Houston Astros','Minute Maid Park','2017-05-04 13:10:00','vs','2017-05-04 15:30:29','2017-09-25 08:08:12',NULL))
  32. SQL;
  33. $this->db->query($sql);
  34. return $this->db->lastInsertId();
  35.  
  36. }
  37.  
  38. public function testGetUnApprovedEvents() {
  39. $data = [
  40. 'exchange_id' => 1,
  41. 'only_flagged_events' => 'false',
  42. 'event_start_date' => '',
  43. 'event_end_date' => '',
  44. 'page' => 1,
  45. 'name_type' => '',
  46. ];
  47. $results = $this->service->getUnApprovedEvents($data);
  48. $this->assertAttributeGreaterThan(0, 'total', $results);
  49. }
  50.  
  51. public function testUpdateExchangeEventId() {
  52. $result = $this->service->updateExchangeEventId($this->bg_event_id_to_map, $this->event_exchange_id, $this->exchange_id);
  53. $this->assertTrue($result);
  54. }
  55.  
  56. public function testApproveEvent() {
  57. $result = $this->service->approveEvent($this->bg_event_id_to_map, $this->exchange_id);
  58. $this->assertEquals(1, $result);
  59. }
  60.  
  61. public function testMarkUnresolveable() {
  62. $result = $this->service->markUnresolveable($this->unresolveable_exchange_id, $this->bg_event_id_to_map, $this->admin_user_id);
  63. $this->assertTrue($result);
  64. }
  65.  
  66. /*
  67. public function testDeleteEventMappingFlags() {
  68.  
  69. }
  70.  
  71. public function testUpdateStubhubEventId() {
  72.  
  73. }
  74. */
  75. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement