/**
  * @expectedException ValidationException
  * @expectedExceptionMessage Creating new memberships is not allowed
  */
 public function testMembersOnly()
 {
     CheckoutConfig::config()->member_creation_enabled = false;
     CheckoutConfig::config()->membership_required = true;
     $result = $this->checkout->createMembership(array('FirstName' => 'Some', 'Surname' => 'Body', 'Email' => '*****@*****.**', 'Password' => 'pass1234'));
     $this->fail("Exception was expected here");
 }
 public function setUp()
 {
     parent::setUp();
     ShopTest::setConfiguration();
     $this->cart = $this->objFromFixture("Order", "cart1");
     $this->address1 = $this->objFromFixture("Address", "address1");
     $this->address2 = $this->objFromFixture("Address", "address2");
     $this->addressNoCountry = $this->objFromFixture("Address", "pukekohe");
     CheckoutConfig::config()->member_creation_enabled = true;
     CheckoutConfig::config()->membership_required = false;
 }
 public function setUp()
 {
     ShopTest::setConfiguration();
     CheckoutConfig::config()->membership_required = false;
     parent::setUp();
     $this->member = $this->objFromFixture("Member", "jeremyperemy");
     $this->cart = $this->objFromFixture("Order", "cart1");
     $this->address1 = $this->objFromFixture("Address", "address1");
     $this->address2 = $this->objFromFixture("Address", "address2");
     $this->config = new CheckoutComponentConfig($this->cart, true);
     $this->config->addComponent(new BillingAddressBookCheckoutComponent());
     $this->address1->MemberID = $this->member->ID;
     $this->address1->write();
 }
 /**
  * Checks if member (or not) is allowed, in accordance with configuration
  */
 public function validateMember($member)
 {
     if (!CheckoutConfig::config()->membership_required) {
         return true;
     }
     if (empty($member) || !$member instanceof Member) {
         return false;
     }
     return true;
 }