public function testCanInsertItemType() { $urlElement = get_db()->getTable('Element')->findByElementSetNameAndElementName('Item Type Metadata', 'URL'); $itemType = insert_item_type(array('name' => 'foobar', 'description' => 'also foobar'), array(array('name' => 'new element'), $urlElement)); $this->assertThat($itemType, $this->isInstanceOf('ItemType')); $this->assertTrue($itemType->exists()); $newFirstElement = $itemType->Elements[0]; $this->assertEquals($newFirstElement->name, 'new element'); $newSecondElement = $itemType->Elements[1]; $this->assertEquals($newSecondElement->name, 'URL'); }
/** * Insert item type and collection, set POST data. */ public function setUp() { parent::setUp(); // Exhibit: $this->exhibit = $this->_exhibit(); // Item type: $this->type = insert_item_type(array('name' => 'Type')); // Collection: $this->collection = insert_collection(array(), array('Dublin Core' => array('Title' => array(array('text' => 'Collection', 'html' => false))))); // Query: $this->query = array('range' => '1-10', 'collection' => $this->collection->id, 'type' => $this->type->id, 'tags' => 'tag1,tag2'); // Set POST data. $this->request->setMethod('POST')->setPost($this->query); }
public function testInsertItemTypeAndInsertElementSetHaveSimilarArguments() { // Insert an item type. $itemType = insert_item_type(array('name' => 'Foobar', 'description' => 'Changed description.'), array(array('name' => 'Wonder'), array('name' => 'Years'))); $elementSet = insert_element_set(array('name' => 'Foobar Element Set', 'description' => 'foobar'), array(array('name' => 'Element Name', 'description' => 'Element Description'))); }