1
1
Fork 0
mirror of https://code.mensbeam.com/MensBeam/Arsse.git synced 2024-12-22 21:22:40 +00:00

Tests for baasic import errors

This commit is contained in:
J. King 2019-07-05 21:18:30 -04:00
parent 103755cfb4
commit 8f9678b8a4

View file

@ -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"]],