зеркало из https://github.com/nextcloud/activity.git
Increase coverage
This commit is contained in:
Родитель
2b38f1a702
Коммит
f14f5e215c
|
@ -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<m>eter1</strong>'],
|
||||
['para<m>eter1', false, false, 'para<m>eter1'],
|
||||
['para<m>eter1', null, null, '<parameter>para<m>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<e>st@l<o>calhost">t<e>st@l<o>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<e>st@l<o>calhost">t<e>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=""remote user""></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>',
|
||||
|
|
Загрузка…
Ссылка в новой задаче