blob: 6f6ad0ffee5eb89c45dc909ee8182b8974e62128 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
<?php
namespace Zotlabs\Tests\Unit\includes;
//use Zotlabs\Photo\PhotoGd;
use Zotlabs\Tests\Unit\UnitTestCase;
//use phpmock\phpunit\PHPMock;
/**
* @brief Unit Test cases for include/photo/photo_driver.php file.
*/
class PhotodriverTest extends UnitTestCase {
//use PHPMock;
public function testPhotofactoryReturnsNullForUnsupportedType() {
// php-mock can not mock global functions which is called by a global function.
// If the calling function is in a namespace it would work.
//$logger = $this->getFunctionMock(__NAMESPACE__, 'logger');
//$logger->expects($this->once());
//$ph = \photo_factory('', 'image/bmp');
//$this->assertNull($ph);
$this->markTestIncomplete('Need to mock logger(), otherwise not unit testable.');
}
public function testPhotofactoryReturnsPhotogdIfConfigIgnore_imagickIsSet() {
// php-mock can not mock global functions which is called by a global function.
// If the calling function is in a namespace it would work.
//$gc = $this->getFunctionMock(__NAMESPACE__, 'get_config');
// simulate get_config('system', 'ignore_imagick') configured
//$gc->expects($this->once())->willReturn(1)
//$ph = \photo_factory(file_get_contents('images/hz-16.png'), 'image/png');
//$this->assertInstanceOf(PhotoGd::class, $ph);
$this->markTestIncomplete('Need to mock get_config(), otherwise not unit testable.');
}
}
|