Skip to content

Instantly share code, notes, and snippets.

@nojimage
Created April 15, 2016 13:33
Show Gist options
  • Save nojimage/96fe19932ce8ed8aaf8292327565b36c to your computer and use it in GitHub Desktop.
Save nojimage/96fe19932ce8ed8aaf8292327565b36c to your computer and use it in GitHub Desktop.
cakephp issue8654 testcode
<?php
public function testUnlockMultipleFieldRemovingFromFields() {
$this->Form->request['_Token'] = array(
'key' => 'testKey',
'unlockedFields' => array()
);
$this->Form->create('Order');
$this->Form->hidden('Order.id', array('value' => 1));
$this->Form->checkbox('Ticked.id.');
$this->Form->checkbox('Ticked.id.');
$this->assertEquals(1, $this->Form->fields['Order.id'], 'Hidden input should be secured.');
$this->assertTrue(in_array('Ticked.id.', $this->Form->fields), 'Field should be secured.');
$this->Form->unlockField('Order.id');
$this->Form->unlockField('Ticked.id');
$this->assertEquals(array(), $this->Form->fields);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment