This commit is contained in:
Joas Schilling 2015-12-11 13:08:45 +01:00
Родитель 2b38f1a702
Коммит f14f5e215c
5 изменённых файлов: 23 добавлений и 2 удалений

Просмотреть файл

@ -149,6 +149,16 @@ class ApiTest extends TestCase {
'subject' => 'Subject1 #A/B.txt',
),
)),
array('activity-api-user1', 5, 1, array(
array(
'link' => 'link',
'file' => 'file',
'date' => null,
'id' => null,
'message' => '',
'subject' => 'Subject2 @User #A/B.txt',
),
)),
);
}

Просмотреть файл

@ -50,6 +50,7 @@ class BaseFormatterTest extends TestCase {
['para<m>eter1', false, true, 'para<m>eter1'],
['para<m>eter1', true, false, '<strong>para&lt;m&gt;eter1</strong>'],
['para<m>eter1', false, false, 'para<m>eter1'],
['para<m>eter1', null, null, '<parameter>para&lt;m&gt;eter1</parameter>'],
];
}

Просмотреть файл

@ -68,11 +68,13 @@ class CloudIDFormatterTest extends TestCase {
['test@localhost', false, true, 'test@localhost'],
['test@localhost', true, false, '<strong class="has-tooltip" title="test@localhost">test@…</strong>'],
['test@localhost', false, false, 'test@…'],
['test@localhost', null, null, '<federated-cloud-id display-name="test@…" user="test" server="localhost">test@localhost</federated-cloud-id>'],
['t<e>st@l<o>calhost', true, true, '<strong class="has-tooltip" title="t&lt;e&gt;st@l&lt;o&gt;calhost">t&lt;e&gt;st@l&lt;o&gt;calhost</strong>'],
['t<e>st@l<o>calhost', false, true, 't<e>st@l<o>calhost'],
['t<e>st@l<o>calhost', true, false, '<strong class="has-tooltip" title="t&lt;e&gt;st@l&lt;o&gt;calhost">t&lt;e&gt;st@…</strong>'],
['t<e>st@l<o>calhost', false, false, 't<e>st@…'],
];
}

Просмотреть файл

@ -82,6 +82,7 @@ class UserFormatterTest extends TestCase {
[false, true, '"remote user"'],
[true, false, '<strong>"remote user"</strong>'],
[false, false, '"remote user"'],
[null, null, '<user display-name="&quot;remote user&quot;"></user>'],
];
}
@ -141,6 +142,8 @@ class UserFormatterTest extends TestCase {
['user2', $this->getUser('Display'), true, false, true, 'Display'],
['user3', $this->getUser('Display'), true, true, false, '<div class="avatar" data-user="user3"></div><strong>Display</strong>'],
['user4', $this->getUser('Display'), true, false, false, 'Display'],
['user5', $this->getUser('Display5'), true, null, null, '<user display-name="Display5">user5</user>'],
['user5', $this->getUser('Display5'), false, null, null, '<user display-name="Display5">user5</user>'],
];
}

Просмотреть файл

@ -165,6 +165,7 @@ class CollectionTest extends TestCase {
[true, false, ['One', 'Two'], ['OneFalse', 'TwoFalse']],
[false, true, ['One', 'Two'], ['OneFalse', 'TwoFalse']],
[false, false, ['OneFalse', 'TwoFalse'], ['OneFalse', 'TwoFalse']],
[null, null, ['OneNull', 'TwoNull'], ['OneFalse', 'TwoFalse'], '<collection>return(joinParameterList)</collection>'],
];
}
@ -175,8 +176,9 @@ class CollectionTest extends TestCase {
* @param bool $verbose
* @param array $parameterList
* @param array $plainParameterList
* @param string $expected
*/
public function testFormat($allowHtml, $verbose, array $parameterList, array $plainParameterList) {
public function testFormat($allowHtml, $verbose, array $parameterList, array $plainParameterList, $expected = 'return(joinParameterList)') {
$collection = $this->getCollection(['joinParameterList']);
/** @var \OCA\Activity\Parameter\IParameter|\PHPUnit_Framework_MockObject_MockObject $parameter1 */
@ -187,6 +189,7 @@ class CollectionTest extends TestCase {
->method('format')
->willReturnMap([
[false, false, 'OneFalse'],
[null, null, 'OneNull'],
[$allowHtml, $verbose, 'One'],
]);
@ -198,6 +201,7 @@ class CollectionTest extends TestCase {
->method('format')
->willReturnMap([
[false, false, 'TwoFalse'],
[null, null, 'TwoNull'],
[$allowHtml, $verbose, 'Two'],
]);
@ -210,7 +214,7 @@ class CollectionTest extends TestCase {
->with($parameterList, $plainParameterList, $allowHtml)
->willReturn('return(joinParameterList)');
$this->assertSame('return(joinParameterList)', $collection->format($allowHtml, $verbose));
$this->assertSame($expected, $collection->format($allowHtml, $verbose));
}
public function dataJoinParameterList() {
@ -226,6 +230,7 @@ class CollectionTest extends TestCase {
[3, true, '<strong>item1</strong>, <strong>item2</strong> and <strong>item3</strong>'],
[3, false, 'item1, item2 and item3'],
[3, null, 'item1item2item3'],
[
6, true,
'<strong>item1</strong>, <strong>item2</strong>, <strong>item3</strong> and <strong class="has-tooltip" title="item4, item5, item6">3 more</strong>',