mirror of
https://code.mensbeam.com/MensBeam/Arsse.git
synced 2024-12-22 13:12:41 +00:00
Tests for baasic import errors
This commit is contained in:
parent
103755cfb4
commit
8f9678b8a4
1 changed files with 28 additions and 1 deletions
|
@ -147,7 +147,34 @@ class TestImportExport extends \JKingWeb\Arsse\Test\AbstractTest {
|
|||
self::clearData();
|
||||
}
|
||||
|
||||
public function testMakeNoEffectiveChnages() {
|
||||
public function testImportForAMissingUser() {
|
||||
\Phake::when(Arsse::$user)->exists->thenReturn(false);
|
||||
$this->assertException("doesNotExist", "User");
|
||||
$this->proc->import("john.doe@example.com", "", false, false);
|
||||
}
|
||||
|
||||
public function testImportWithInvalidFolder() {
|
||||
$in = [[
|
||||
], [1 =>
|
||||
['id' => 1, 'name' => "", 'parent' => 0],
|
||||
]];
|
||||
\Phake::when($this->proc)->parse->thenReturn($in);
|
||||
$this->assertException("invalidFolderName", "ImportExport");
|
||||
$this->proc->import("john.doe@example.com", "", false, false);
|
||||
}
|
||||
|
||||
public function testImportWithDuplicateFolder() {
|
||||
$in = [[
|
||||
], [1 =>
|
||||
['id' => 1, 'name' => "New", 'parent' => 0],
|
||||
['id' => 2, 'name' => "New", 'parent' => 0],
|
||||
]];
|
||||
\Phake::when($this->proc)->parse->thenReturn($in);
|
||||
$this->assertException("invalidFolderCopy", "ImportExport");
|
||||
$this->proc->import("john.doe@example.com", "", false, false);
|
||||
}
|
||||
|
||||
public function testMakeNoEffectiveChanges() {
|
||||
$in = [[
|
||||
['url' => "http://localhost:8000/Import/nasa-jpl", 'title' => "NASA JPL", 'folder' => 3, 'tags' => ["tech"]],
|
||||
['url' => "http://localhost:8000/Import/ars", 'title' => "Ars Technica", 'folder' => 2, 'tags' => ["frequent", "tech"]],
|
||||
|
|
Loading…
Reference in a new issue