mirror of
https://github.com/nextcloud/passman.git
synced 2024-11-13 19:39:53 +08:00
99 lines
No EOL
14 KiB
PHP
99 lines
No EOL
14 KiB
PHP
<?php
|
|
/**
|
|
* Nextcloud - passman
|
|
*
|
|
* @copyright Copyright (c) 2016, Sander Brand (brantje@gmail.com)
|
|
* @copyright Copyright (c) 2016, Marcos Zuriaga Miguel (wolfi@wolfi.es)
|
|
* @license GNU AGPL version 3 or any later version
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU Affero General Public License as
|
|
* published by the Free Software Foundation, either version 3 of the
|
|
* License, or (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU Affero General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*
|
|
*/
|
|
|
|
use \OCA\Passman\Db\File;
|
|
|
|
/**
|
|
* @coversDefaultClass \OCA\Passman\Db\File
|
|
*/
|
|
class FileTest extends PHPUnit_Framework_TestCase {
|
|
CONST TEST_DATA = [
|
|
'id' => 21,
|
|
'guid' => 'FC148F1A-AA67-489E-ABF5-4D7AA525F067',
|
|
'user_id' => 'WolFi',
|
|
'mimetype' => 'text/x-arduino',
|
|
'filename' => 'eyJpdiI6ImVPcEY5WWRlT0FHcjdiekZ3V0RXSnciLCJ2IjoxLCJpdGVyIjoxMDAwLCJrcyI6MjU2LCJ0cyI6NjQsIm1vZGUiOiJjY20iLCJhZGF0YSI6IiIsImNpcGhlciI6ImFlcyIsInNhbHQiOiJtdG5CT2ZOL3hlRSIsImN0IjoialJFSHJ3S3JpK2FhaDJ5bUxUWnJRaWtKVVZIL2x4SSJ9',
|
|
'size' => 4509,
|
|
'created' => 1475853609,
|
|
'file_data' => 'eyJpdiI6IjBlcnVNMTBMY3VpNW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QxeTRxU2JieDlvRm5IZG4rdU93czZ3ZmhBclhvRHpHMDIzWTY0T1dFdUNBTmJ4WjBRT0lTdTYzZGpPalBPczBhbDVzdXVSSWQ2dTlublp4dUE2MEJSLzBmdWd6R2N2UG5qZi8yNkJvc0lCMUhWY1RMc3pDR1R6Q2hDV1RQTk92TU03Zk42UGczN2l2dnNGdFREelVwcm5NQ1VpY0JYU01LbjBwTjBHbmZvU2I5cEdodDhyT2RBREhuMk9TbDVhK0tiMUhKa3VDZjFzcTBRcHhlTXRJb1VhcnZXVWduRkJwcVZaSlQ1Y1AwekljNjkrb3pyYmJTMkJKS1ZSWSsrbXRMSnJ2dXhqTE12MjgzRzQifQ==',
|
|
];
|
|
|
|
/**
|
|
* @var File
|
|
*/
|
|
protected $file;
|
|
|
|
/**
|
|
* @after
|
|
*/
|
|
public function setUp() {
|
|
$this->file = File::fromRow(self::TEST_DATA);
|
|
}
|
|
|
|
/**
|
|
* @covers ::getter
|
|
* @covers ::__construct
|
|
* @covers ::fromRow
|
|
*/
|
|
public function testGetters() {
|
|
$this->assertEquals(self::TEST_DATA['id'], $this->file->getId());
|
|
$this->assertEquals(self::TEST_DATA['guid'], $this->file->getGuid());
|
|
$this->assertEquals(self::TEST_DATA['user_id'], $this->file->getUserId());
|
|
$this->assertEquals(self::TEST_DATA['mimetype'], $this->file->getMimetype());
|
|
$this->assertEquals(self::TEST_DATA['filename'], $this->file->getFilename());
|
|
$this->assertEquals(self::TEST_DATA['size'], $this->file->getSize());
|
|
$this->assertEquals(self::TEST_DATA['created'], $this->file->getCreated());
|
|
$this->assertEquals(self::TEST_DATA['file_data'], $this->file->getFileData());
|
|
}
|
|
|
|
/**
|
|
* @covers ::setter
|
|
*/
|
|
public function testSetters() {
|
|
/**
|
|
* Only testing one setter since if it works all setters should work because php magic.
|
|
* please, if you override a setter implement it here.
|
|
*/
|
|
$this->file->setMimetype('text/json');
|
|
$this->assertEquals('text/json', $this->file->getMimetype());
|
|
}
|
|
|
|
/**
|
|
* @covers ::jsonSerialize
|
|
*/
|
|
public function testJsonSerialize(){
|
|
$expected_result = [
|
|
'file_id' => self::TEST_DATA['id'],
|
|
'filename' => self::TEST_DATA['filename'],
|
|
'guid' => self::TEST_DATA['guid'],
|
|
'size' => self::TEST_DATA['size'],
|
|
'file_data' => self::TEST_DATA['file_data'],
|
|
'created' => self::TEST_DATA['created'],
|
|
'mimetype' => self::TEST_DATA['mimetype'],
|
|
];
|
|
|
|
$actual_data = $this->file->jsonSerialize();
|
|
|
|
$this->assertEquals($expected_result, $actual_data);
|
|
}
|
|
} |