mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
test: Separate FormHelperTest::testSecuredFileInput() by PHP Version.
Added 'full_path' key https://www.php.net/manual/en/migration81.new-features.php#migration81.new-features.core.upload-full-path-key
This commit is contained in:
parent
9115ec765f
commit
7df7fefca4
1 changed files with 25 additions and 1 deletions
|
@ -1699,11 +1699,13 @@ class FormHelperTest extends CakeTestCase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Tests that the correct keys are added to the field hash index
|
||||
* Tests that the correct keys are added to the field hash index (For PHP < 8.1)
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testSecuredFileInput() {
|
||||
$this->skipIf(version_compare(PHP_VERSION, '8.1.0', '>='));
|
||||
|
||||
$this->Form->request['_Token'] = array('key' => 'testKey');
|
||||
$this->assertEquals(array(), $this->Form->fields);
|
||||
|
||||
|
@ -1715,6 +1717,28 @@ class FormHelperTest extends CakeTestCase {
|
|||
$this->assertEquals($expected, $this->Form->fields);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that the correct keys are added to the field hash index (For PHP >= 8.1)
|
||||
*
|
||||
* Added full_path key
|
||||
*
|
||||
* @see https://www.php.net/manual/en/migration81.new-features.php#migration81.new-features.core.upload-full-path-key
|
||||
* @return void
|
||||
*/
|
||||
public function testSecuredFileInputForPhp81Plus() {
|
||||
$this->skipIf(version_compare(PHP_VERSION, '8.1.0', '<'));
|
||||
|
||||
$this->Form->request['_Token'] = array('key' => 'testKey');
|
||||
$this->assertEquals(array(), $this->Form->fields);
|
||||
|
||||
$this->Form->file('Attachment.file');
|
||||
$expected = array(
|
||||
'Attachment.file.name', 'Attachment.file.type', 'Attachment.file.tmp_name',
|
||||
'Attachment.file.error', 'Attachment.file.size', 'Attachment.file.full_path'
|
||||
);
|
||||
$this->assertEquals($expected, $this->Form->fields);
|
||||
}
|
||||
|
||||
/**
|
||||
* test that multiple selects keys are added to field hash
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue