Skip to content

Commit

Permalink
Remove backwards compatibility code.
Browse files Browse the repository at this point in the history
  • Loading branch information
ADmad committed Oct 27, 2020
1 parent c9f9b99 commit 790b41b
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 15 deletions.
6 changes: 0 additions & 6 deletions src/File/Path/Filename/DefaultTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,6 @@ public function filename(): string
{
$processor = Hash::get($this->settings, 'nameCallback', null);
if (is_callable($processor)) {
$processor = Closure::fromCallable($processor);
$numberOfParameters = (new ReflectionFunction($processor))->getNumberOfParameters();
if ($numberOfParameters == 2) {
return $processor($this->data, $this->settings);
}

return $processor($this->table, $this->entity, $this->data, $this->field, $this->settings);
}

Expand Down
9 changes: 0 additions & 9 deletions tests/TestCase/File/Path/Filename/DefaultTraitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,6 @@ public function testFilename()
$mock->data = new UploadedFile(fopen('php://temp', 'wb+'), 150, UPLOAD_ERR_OK, 'filename');
$this->assertEquals('filename', $mock->filename());

$mock = $this->getMockForTrait('Josegonzalez\Upload\File\Path\Filename\DefaultTrait');
$mock->settings = [
'nameCallback' => function ($data, $settings) {
return $data->getClientFilename();
},
];
$mock->data = new UploadedFile(fopen('php://temp', 'wb+'), 150, UPLOAD_ERR_OK, 'filename');
$this->assertEquals('filename', $mock->filename());

$mock = $this->getMockForTrait('Josegonzalez\Upload\File\Path\Filename\DefaultTrait');
$mock->entity = $this->getMockBuilder('Cake\ORM\Entity')->getMock();
$mock->table = $this->getMockBuilder('Cake\ORM\Table')->getMock();
Expand Down

0 comments on commit 790b41b

Please sign in to comment.