Skip to content
This repository has been archived by the owner on Mar 5, 2022. It is now read-only.

Commit

Permalink
beforeMarshal test
Browse files Browse the repository at this point in the history
  • Loading branch information
robertpustulka committed Aug 14, 2015
1 parent 944ef54 commit a918dff
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/TestCase/Model/Table/FileStorageTest.php
Expand Up @@ -92,4 +92,29 @@ public function testAfterDelete() {
$result = $this->FileStorage->afterDelete($event, $entity, []);
$this->assertTrue($result);
}

/**
* testBeforeMarshal
*
* @return void
*/
public function testBeforeMarshal() {
$filename = \Cake\Core\Plugin::path('Burzum/FileStorage') . DS . 'tests' . DS . 'Fixture' . DS . 'File' . DS . 'titus.jpg';
$event = new Event('Model.beforeMarshal', $this->FileStorage);

$data = new \ArrayObject([
'file' => [
'name' => 'titus.jpg',
'tmp_name' => $filename
]
]);

$this->FileStorage->beforeMarshal($event, $data);

$this->assertEquals(332643, $data['filesize']);
$this->assertEquals('Local', $data['adapter']);
$this->assertEquals('image/jpeg', $data['mime_type']);
$this->assertEquals('jpg', $data['extension']);
$this->assertEquals('file_storage', $data['model']);
}
}

0 comments on commit a918dff

Please sign in to comment.