зеркало из https://github.com/nextcloud/news.git
more integration tests
This commit is contained in:
Родитель
5395685b05
Коммит
dcf96e7299
|
@ -252,7 +252,7 @@
|
|||
<name>status</name>
|
||||
<type>integer</type>
|
||||
<length>8</length>
|
||||
<notnull>true</notnull>
|
||||
<notnull>false</notnull>
|
||||
</field>
|
||||
<field>
|
||||
<name>last_modified</name>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<name>News</name>
|
||||
<description>An RSS/Atom feed reader. Requires ownCloud backgroundjobs or an updater script to be enabled to update your feeds. See the README.md in the apps top directory</description>
|
||||
<licence>AGPL</licence>
|
||||
<version>3.999.3</version>
|
||||
<version>3.999.4</version>
|
||||
<require>7.0.3</require>
|
||||
<author>Bernhard Posselt, Alessandro Cosentino, Jan-Christoph Borchardt</author>
|
||||
</info>
|
||||
|
|
|
@ -78,7 +78,7 @@ class NewsIntegrationTest extends \PHPUnit_Framework_TestCase {
|
|||
if (array_key_exists($feed['title'], $items)) {
|
||||
foreach ($items[$feed['title']] as $item) {
|
||||
$item['feedId'] = $newFeed->getId();
|
||||
$this->items[$item->getTitle()] =
|
||||
$this->items[$item['title']] =
|
||||
$this->createItem($item);
|
||||
}
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ class NewsIntegrationTest extends \PHPUnit_Framework_TestCase {
|
|||
if (array_key_exists($feed['title'], $items)) {
|
||||
foreach ($items[$feed['title']] as $item) {
|
||||
$item['feedId'] = $newFeed->getId();
|
||||
$this->items[$item->getTitle()] =
|
||||
$this->items[$item['title']] =
|
||||
$this->createItem($item);
|
||||
}
|
||||
}
|
||||
|
@ -147,13 +147,13 @@ class NewsIntegrationTest extends \PHPUnit_Framework_TestCase {
|
|||
$newItem->setLastModified($item['lastModified']);
|
||||
$newItem->setEnclosureMime($item['enclosureMime']);
|
||||
$newItem->setEnclosureLink($item['enclosureLink']);
|
||||
return $this->itemMapper->insert($item);
|
||||
return $this->itemMapper->insert($newItem);
|
||||
}
|
||||
|
||||
|
||||
protected function whenOlderThan($olderThan, $callback) {
|
||||
$ocVersion = $this->ownCloudVersion;
|
||||
if (version_compare(implode('.', $ocVersion), $olderThan, '<=')) {
|
||||
if (version_compare(implode('.', $ocVersion), $olderThan, '<')) {
|
||||
$callback();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,4 +28,40 @@ class ItemMapperTest extends NewsIntegrationTest {
|
|||
$this->assertEquals('Döner', $fetched->getBody());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @expectedException OCP\AppFramework\Db\DoesNotExistException
|
||||
*/
|
||||
public function testFindNotFoundWhenDeletedFeed() {
|
||||
$id = $this->items['not found feed']->getId();
|
||||
$this->itemMapper->find($id, $this->userId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @expectedException OCP\AppFramework\Db\DoesNotExistException
|
||||
*/
|
||||
public function testFindNotFoundWhenDeletedFolder() {
|
||||
$id = $this->items['not found folder']->getId();
|
||||
$this->itemMapper->find($id, $this->userId);
|
||||
}
|
||||
|
||||
|
||||
public function testDeleteOlderThanThreshold() {
|
||||
$this->itemMapper->deleteReadOlderThanThreshold(1);
|
||||
$item1 = $this->items['del1'];
|
||||
$item2 = $this->items['del2'];
|
||||
$item3 = $this->items['del3'];
|
||||
$item4 = $this->items['del4'];
|
||||
|
||||
$this->itemMapper->find($item3->getId(), $this->userId);
|
||||
$this->itemMapper->find($item4->getId(), $this->userId);
|
||||
|
||||
//$this->setExpectedException(
|
||||
// 'OCP\AppFramework\Db\DoesNotExistException');
|
||||
$this->itemMapper->find($item1->getId(), $this->userId);
|
||||
$this->itemMapper->find($item2->getId(), $this->userId);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -10,7 +10,7 @@
|
|||
"added": 3000,
|
||||
"link": "http://feed.com/rss",
|
||||
"preventUpdate": false,
|
||||
"articlesPerUpdate": 40,
|
||||
"articlesPerUpdate": 1,
|
||||
"lastModified": "",
|
||||
"etag": ""
|
||||
},
|
||||
|
@ -44,7 +44,7 @@
|
|||
"etag": ""
|
||||
},
|
||||
{
|
||||
"title": "fifth feed",
|
||||
"title": "sixth feed",
|
||||
"url": "http://gremlins.de",
|
||||
"deletedAt": 999999999,
|
||||
"location": "http://feed.com/rss",
|
||||
|
|
|
@ -1,5 +1,116 @@
|
|||
{
|
||||
"first feed": [
|
||||
|
||||
]
|
||||
"first feed": [
|
||||
{
|
||||
"status": 2,
|
||||
"body": "this is a body",
|
||||
"title": "a title1",
|
||||
"author": "my author",
|
||||
"guid": "abc",
|
||||
"url": "http://google.de",
|
||||
"pubDate": 2323,
|
||||
"lastModified": 113,
|
||||
"enclosureMime": "video/mpeg",
|
||||
"enclosureLink": "http://google.de/web.webm"
|
||||
},
|
||||
{
|
||||
"status": 0,
|
||||
"body": "this is a body",
|
||||
"title": "del1",
|
||||
"author": "my author",
|
||||
"guid": "del1",
|
||||
"url": "http://google.de",
|
||||
"pubDate": 2323,
|
||||
"lastModified": 113,
|
||||
"enclosureMime": "video/mpeg",
|
||||
"enclosureLink": "http://google.de/web.webm"
|
||||
},
|
||||
{
|
||||
"status": 0,
|
||||
"body": "this is a body",
|
||||
"title": "del2",
|
||||
"author": "my author",
|
||||
"guid": "del2",
|
||||
"url": "http://google.de",
|
||||
"pubDate": 2323,
|
||||
"lastModified": 113,
|
||||
"enclosureMime": "video/mpeg",
|
||||
"enclosureLink": "http://google.de/web.webm"
|
||||
},
|
||||
{
|
||||
"status": 0,
|
||||
"body": "this is a body",
|
||||
"title": "del3",
|
||||
"author": "my author",
|
||||
"guid": "del3",
|
||||
"url": "http://google.de",
|
||||
"pubDate": 2323,
|
||||
"lastModified": 113,
|
||||
"enclosureMime": "video/mpeg",
|
||||
"enclosureLink": "http://google.de/web.webm"
|
||||
},
|
||||
{
|
||||
"status": 0,
|
||||
"body": "this is a body",
|
||||
"title": "del4",
|
||||
"author": "my author",
|
||||
"guid": "del4",
|
||||
"url": "http://google.de",
|
||||
"pubDate": 2323,
|
||||
"lastModified": 113,
|
||||
"enclosureMime": "video/mpeg",
|
||||
"enclosureLink": "http://google.de/web.webm"
|
||||
},
|
||||
{
|
||||
"status": 4,
|
||||
"body": "this is a body",
|
||||
"title": "a title2",
|
||||
"author": "my author",
|
||||
"guid": "def",
|
||||
"url": "http://google.de",
|
||||
"pubDate": 2323,
|
||||
"lastModified": 113,
|
||||
"enclosureMime": "video/mpeg",
|
||||
"enclosureLink": "http://google.de/web.webm"
|
||||
},
|
||||
{
|
||||
"status": 6,
|
||||
"body": "this is a body",
|
||||
"title": "a title3",
|
||||
"author": "my author",
|
||||
"guid": "gih",
|
||||
"url": "http://google.de",
|
||||
"pubDate": 2323,
|
||||
"lastModified": 113,
|
||||
"enclosureMime": "video/mpeg",
|
||||
"enclosureLink": "http://google.de/web.webm"
|
||||
}
|
||||
],
|
||||
"fifth feed": [
|
||||
{
|
||||
"status": 2,
|
||||
"body": "this is a body",
|
||||
"title": "not found folder",
|
||||
"author": "my author",
|
||||
"guid": "not found",
|
||||
"url": "http://google.de",
|
||||
"pubDate": 2323,
|
||||
"lastModified": 113,
|
||||
"enclosureMime": "video/mpeg",
|
||||
"enclosureLink": "http://google.de/web.webm"
|
||||
}
|
||||
],
|
||||
"sixth feed": [
|
||||
{
|
||||
"status": 2,
|
||||
"body": "this is a body",
|
||||
"title": "not found feed",
|
||||
"author": "my author",
|
||||
"guid": "not found",
|
||||
"url": "http://google.de",
|
||||
"pubDate": 2323,
|
||||
"lastModified": 113,
|
||||
"enclosureMime": "video/mpeg",
|
||||
"enclosureLink": "http://google.de/web.webm"
|
||||
}
|
||||
]
|
||||
}
|
Загрузка…
Ссылка в новой задаче