Esempio n. 1
0
 public function testIsAttributeRequired()
 {
     $singer = new Singer();
     $this->assertFalse($singer->isAttributeRequired('firstName'));
     $this->assertTrue($singer->isAttributeRequired('lastName'));
 }
Esempio n. 2
0
 public function testIsAttributeRequired()
 {
     $singer = new Singer();
     $this->assertFalse($singer->isAttributeRequired('firstName'));
     $this->assertTrue($singer->isAttributeRequired('lastName'));
     // attribute is not marked as required when a conditional validation is applied using `$when`.
     // the condition should not be applied because this info may be retrieved before model is loaded with data
     $singer->firstName = 'qiang';
     $this->assertFalse($singer->isAttributeRequired('test'));
     $singer->firstName = 'cebe';
     $this->assertFalse($singer->isAttributeRequired('test'));
 }