*
* SPDX-License-Identifier: MIT
*/
namespace Zotlabs\Tests\Unit\Widget;
use App;
use Zotlabs\Widget\Messages;
use Zotlabs\Tests\Unit\Module\TestCase;
class MessagesWidgetTest extends TestCase
{
use \phpmock\phpunit\PHPMock;
/**
* List of file tags should be empty if there are no file tags.
*/
public function testNoFileTags(): void
{
$local_channe_stub = $this->getFunctionMock('Zotlabs\Widget', 'local_channel')
->expects($this->any())
->willReturn(42);
$feature_enabled_stub = $this->getFunctionMock('Zotlabs\Widget', 'feature_enabled')
->expects($this->any())
->willReturn(true);
$this->renderWidget();
$this->assertOutputMatches('||');
}
/**
* The widget lists file tags that are defined for the channel.
*/
public function testFileTagsAreListed(): void
{
$local_channe_stub = $this->getFunctionMock('Zotlabs\Widget', 'local_channel')
->expects($this->any())
->willReturn(42);
$feature_enabled_stub = $this->getFunctionMock('Zotlabs\Widget', 'feature_enabled')
->expects($this->any())
->willReturn(true);
/*
* Add a few tags.
*/
store_item_tag(42, 1, TERM_OBJ_POST, TERM_FILE, 'test_file_tag', '');
store_item_tag(42, 1, TERM_OBJ_POST, TERM_FILE, 'test_file_tag2', '');
$this->renderWidget();
$this->assertOutputMatches('|