Files
roundcubemail/tests/Actions/Contacts/PhotoTest.php
Aleksander Machniak 825fb4fb58 Fix tests regression
2024-08-04 10:53:03 +02:00

49 lines
1.2 KiB
PHP

<?php
namespace Roundcube\Tests\Actions\Contacts;
use Roundcube\Tests\ActionTestCase;
use Roundcube\Tests\OutputJsonMock;
/**
* Test class to test rcmail_action_contacts_photo
*/
class PhotoTest extends ActionTestCase
{
/**
* Test run() method - no photo case
*/
public function test_no_photo()
{
$action = new \rcmail_action_contacts_photo();
$output = $this->initOutput(\rcmail_action::MODE_HTTP, 'contacts', 'photo');
$this->assertInstanceOf(\rcmail_action::class, $action);
$this->assertTrue($action->checks());
$this->runAndAssert($action, OutputJsonMock::E_EXIT);
$result = $output->getOutput();
$this->assertContains('Content-Type: image/gif', $output->headers);
$this->assertSame(base64_decode(\rcmail_output::BLANK_GIF, true), $result);
$_GET = ['_error' => 1];
$this->runAndAssert($action, OutputJsonMock::E_EXIT);
$result = $output->getOutput();
$this->assertContains('HTTP/1.0 204 Photo not found', $output->headers);
$this->assertSame('', $result);
}
/**
* Test run() method - a contact with real photo
*/
public function test_photo()
{
$this->markTestIncomplete();
}
}