예제 #1
0
 public function testOrderTotal()
 {
     $rule = new OrderTotalRule();
     // Equal
     $rule->initialize('=', 100);
     $this->assertTrue($rule->isValid($this->getSubject()));
     $rule->val(20);
     $this->assertFalse($rule->isValid($this->getSubject()));
     // Greater than
     $rule->op('>')->val(80);
     $this->assertTrue($rule->isValid($this->getSubject()));
     $rule->val(100);
     $this->assertFalse($rule->isValid($this->getSubject()));
     // Lesser than
     $rule->op('<')->val(150);
     $this->assertTrue($rule->isValid($this->getSubject()));
     $rule->val(90);
     $this->assertFalse($rule->isValid($this->getSubject()));
 }