/** * This module always requires a page model. */ public function requireDefaultRecords() { parent::requireDefaultRecords(); if (!self::get()->exists() && $this->config()->create_default_pages) { $page = self::create(array('Title' => 'Checkout', 'URLSegment' => CheckoutPage_Controller::config()->url_segment, 'ShowInMenus' => 0)); $page->write(); $page->publish('Stage', 'Live'); $page->flushCache(); DB::alteration_message('Checkout page created', 'created'); } }
public function testSummary() { $this->checkout->summary(); $form = $this->checkout->ConfirmationForm(); $data = array('Notes' => 'Leave it around the back', 'ReadTermsAndConditions' => 1); $member = $this->objFromFixture("Member", "joebloggs"); $member->logIn(); //log in member before processing Checkout::get($this->cart)->setPaymentMethod("Dummy"); //a selected payment method is required $form->loadDataFrom($data); $this->assertTrue($form->validate(), "Checkout data is valid"); $response = $this->post('/checkout/ConfirmationForm', $data); $this->assertEquals('Cart', $this->cart->Status, "Order is still in cart"); $order = Order::get()->byID($this->cart->ID); $this->assertEquals("Leave it around the back", $order->Notes); //redirect to make payment $this->assertEquals(302, $response->getStatusCode()); $this->assertEquals(Director::baseURL() . "checkout/payment", $response->getHeader('Location')); }
/** * Check if passed action is for a step after current */ public function IsFutureStep($name) { return $this->compareActions($name, $this->owner->getAction()) > 0; }