/** * Test that shorthand splitting works. */ public function testSplitShorthand() { // only a rule $this->assertEquals(array('rule' => 'boolean', 'message' => '', 'options' => array()), $this->object->splitShorthand('boolean')); // rule with 1 param $this->assertEquals(array('rule' => 'decimal', 'message' => '', 'options' => array(1)), $this->object->splitShorthand('decimal:1')); // rule with 2 params $this->assertEquals(array('rule' => 'between', 'message' => '', 'options' => array(1, 10)), $this->object->splitShorthand('between:1,10')); // only a rule and message $this->assertEquals(array('rule' => 'boolean', 'message' => 'Must be a boolean!', 'options' => array()), $this->object->splitShorthand('boolean::Must be a boolean!')); // rule with 2 params and message $this->assertEquals(array('rule' => 'between', 'message' => 'Must be between 1:10!', 'options' => array(1, 10)), $this->object->splitShorthand('between:1,10:Must be between 1:10!')); }