コード例 #1
0
 public function testModelHidesHiddenFields()
 {
     $model = new RealModelStub(['myField' => 'value', 'anotherField' => 'yeah', 'someField' => 'whatever', 'hiddenField' => 'secrets!', 'passwordHash' => '1234']);
     $modelArray = $model->toArray();
     $this->assertFalse(isset($modelArray['hiddenField']));
     $this->assertFalse(isset($modelArray['passwordHash']));
     $this->assertEquals('secrets!', $model->getAttribute('hiddenField'));
     $this->assertEquals('1234', $model->getAttribute('passwordHash'));
 }