Beispiel #1
0
 /**
  * to validate post data with multi language content
  * 
  * @param Muratsplat\Multilang\Interfaces\MainInterface $model
  * @param array $rules
  * @return bool  true, if it is on success
  */
 private function validateAll(Model $model, array $rules)
 {
     if (!$this->validator->make($this->picker, $model, $rules)) {
         $this->message = $this->validator->getMessageBag();
         return false;
     }
     return true;
 }
Beispiel #2
0
 public function testIssueLastRulesStillExistWheItMakesNewValidation()
 {
     $rulesShoudldBe = ['enable' => 'required', 'visible' => 'required', 'title@1' => 'max:100', 'content@1' => 'max:15000', 'title@2' => 'max:100|RequiredForDefaultLang:Page Title', 'content@2' => 'max:15000', 'title@3' => 'max:100|RequiredForDefaultLang:Page Title', 'content@3' => 'max:15000'];
     $main = $this->getMainModel();
     $this->validator->make($this->picker, $main, array('oldRulesFromOldJobs' => 'BlaAndBla'));
     $this->validator->make($this->picker, $main, array('title@1' => 'max:100'));
     $this->assertEquals($rulesShoudldBe, $this->validator->getRules());
 }