Esempio n. 1
0
 /**
  * Test creating a draft order and upgrading it
  */
 public function test_draft_order_creation()
 {
     $order = appthemes_new_order();
     $this->assertNotEmpty($order);
     $draft_order = new APP_Draft_Order();
     $draft_order->set_description('Draft');
     $draft_order->set_gateway('paypal');
     $draft_order->set_currency('EUR');
     $draft_order->add_item('test', 5, $order->get_id());
     $this->assertEquals('Draft', $draft_order->get_description());
     $this->assertEquals('paypal', $draft_order->get_gateway());
     $this->assertEquals('EUR', $draft_order->get_currency());
     $this->assertEquals(5, $draft_order->get_total());
     $this->assertCount(1, $draft_order->get_items());
     $new_order = appthemes_new_order($draft_order);
     $this->assertEquals('Draft', $new_order->get_description());
     $this->assertEquals('paypal', $new_order->get_gateway());
     $this->assertEquals('EUR', $new_order->get_currency());
     $this->assertEquals(5, $new_order->get_total());
     $this->assertCount(1, $new_order->get_items());
 }
Esempio n. 2
0
 public function test_upgrade_order()
 {
     $order = new APP_Draft_Order();
     $order->set_description('Draft');
     $order->set_gateway('paypal');
     $order->set_currency('EUR');
     // We need an existing order that can be connected to
     $real_order = APP_Order_Factory::create();
     $status = $order->add_item('test', 5, $real_order->get_id());
     $new_real_order = APP_Draft_Order::upgrade($order);
     $this->assertEquals('Draft', $new_real_order->get_description());
     $this->assertEquals('paypal', $new_real_order->get_gateway());
     $this->assertEquals('EUR', $new_real_order->get_currency());
     $this->assertCount(1, $new_real_order->get_items());
     $this->assertEquals(5, $new_real_order->get_total());
 }