public function testMapWithoutCollection() { $collection = new Collection(); $collection->addElementTextsByArray(array('Dublin Core' => array('Title' => array(array('text' => 'Plants', 'html' => false))))); $collection->save(); $row = array('title' => 'Animals', 'description' => 'Foo'); $map = new CsvImport_ColumnMap_Collection('title'); $this->assertFalse($map->map($row, array())); }
public function testMapWithoutCollection() { $collection = new Collection(); $collection->addElementTextsByArray(array('Dublin Core' => array('Title' => array(array('text' => 'Plants', 'html' => false))))); $collection->save(); $row = array('title' => 'Animals', 'description' => 'Foo'); $map = new CsvImport_ColumnMap_Collection('title'); $this->markTestSkipped(__('Since 2.2-full, collections are checked during import.')); $this->assertFalse($map->map($row, array())); }
public function testOwnerIdNotSetWhenUpdatingCollection() { $user = $this->_getDefaultUser(); $this->_authenticateUser($user); //create collection $collection = new Collection(); $elementTexts = array('Dublin Core' => array('Title' => array(array('text' => 'foobar', 'html' => false)), 'Description' => array(array('text' => 'baz', 'html' => false)))); $collection->addElementTextsByArray($elementTexts); $collection->owner_id = $user->id + 1; $collection->save(); $csrf = new Omeka_Form_Element_SessionCsrfToken('csrf_token'); $this->request->setPost(array('Elements' => array(), 'csrf_token' => $csrf->getToken())); $this->request->setMethod('post'); $this->dispatch('collections/edit/' . $collection->id); $this->assertRedirect(); $updatedCollection = $this->db->getTable('Collection')->find($collection->id); $this->assertNotEquals($user->id, $updatedCollection->owner_id, "The owner_id for the collection should not be that of the user who updated the collection."); }