cleanup
This commit is contained in:
parent
d4e0d3859e
commit
836fb96f42
4 changed files with 77 additions and 27 deletions
|
@ -25,7 +25,7 @@ class ItemTest extends TestCase
|
|||
{
|
||||
$event = Event::create(['slug'=>'EVENT','name'=>'Event']);
|
||||
$box = Container::create(['name'=>'BOX']);
|
||||
Item::create(['cid'=>$box->cid, 'eid' => $event->eid, 'item_uid'=>1, 'wann'=>'', 'wo'=>'','description'=>'1']);
|
||||
Item::create(['cid'=>$box->cid, 'eid' => $event->eid, 'wann'=>'', 'wo'=>'','description'=>'1']);
|
||||
|
||||
$this->get('/1/EVENT/items');
|
||||
$response = $this->response->getOriginalContent();
|
||||
|
@ -43,7 +43,7 @@ class ItemTest extends TestCase
|
|||
{
|
||||
$event = Event::create(['slug'=>'EVENT','name'=>'Event']);
|
||||
$box = Container::create(['name'=>'BOX']);
|
||||
$item = Item::create(['cid'=>$box->cid, 'eid' => $event->eid, 'item_uid'=>1, 'wann'=>'', 'wo'=>'','description'=>'1']);
|
||||
$item = Item::create(['cid'=>$box->cid, 'eid' => $event->eid, 'wann'=>'', 'wo'=>'','description'=>'1']);
|
||||
File::create(['iid'=>$item->iid, 'hash'=>'filename']);
|
||||
|
||||
$this->get('/1/EVENT/items');
|
||||
|
@ -62,9 +62,9 @@ class ItemTest extends TestCase
|
|||
{
|
||||
$event = Event::create(['slug'=>'EVENT','name'=>'Event']);
|
||||
$box = Container::create(['name'=>'BOX']);
|
||||
Item::create(['cid'=>$box->cid, 'eid' => $event->eid, 'item_uid'=>1, 'wann'=>'', 'wo'=>'','description'=>'1']);
|
||||
Item::create(['cid'=>$box->cid, 'eid' => $event->eid, 'item_uid'=>2, 'wann'=>'', 'wo'=>'','description'=>'2']);
|
||||
Item::create(['cid'=>$box->cid, 'eid' => $event->eid, 'item_uid'=>3, 'wann'=>'', 'wo'=>'','description'=>'3']);
|
||||
Item::create(['cid'=>$box->cid, 'eid' => $event->eid, 'wann'=>'', 'wo'=>'','description'=>'1']);
|
||||
Item::create(['cid'=>$box->cid, 'eid' => $event->eid, 'wann'=>'', 'wo'=>'','description'=>'2']);
|
||||
Item::create(['cid'=>$box->cid, 'eid' => $event->eid, 'wann'=>'', 'wo'=>'','description'=>'3']);
|
||||
|
||||
$this->get('/1/EVENT/items');
|
||||
$response = $this->response->getOriginalContent();
|
||||
|
@ -77,13 +77,13 @@ class ItemTest extends TestCase
|
|||
|
||||
Event::create(['slug'=>'EVENT','name'=>'Event']);
|
||||
$box = Container::create(['name'=>'BOX']);
|
||||
$this->post('/1/EVENT/item',['cid'=>$box->cid, 'wann'=>'', 'description'=>'1']);
|
||||
$this->post('/1/EVENT/item',['cid'=>$box->cid, 'description'=>'1']);
|
||||
$response = $this->response->getOriginalContent();
|
||||
|
||||
$this->assertResponseStatus(201);
|
||||
$this->assertEquals(1, $response['item_uid']);
|
||||
$this->assertEquals('1', $response['description']);
|
||||
//$this->assertEquals($box->name, $response['box']);
|
||||
$this->assertEquals($box->name, $response['box']);
|
||||
$this->assertEquals($box->cid, $response['cid']);
|
||||
//$this->assertEquals('filename', $response['file']);
|
||||
|
||||
|
@ -91,7 +91,7 @@ class ItemTest extends TestCase
|
|||
$this->assertEquals(1, count($items));
|
||||
$this->assertEquals(1, $items[0]['item_uid']);
|
||||
$this->assertEquals('1', $items[0]['description']);
|
||||
//$this->assertEquals($box->name, $items[0]['box']);
|
||||
$this->assertEquals($box->name, $items[0]['box']);
|
||||
$this->assertEquals($box->cid, $items[0]['cid']);
|
||||
//$this->assertEquals('filename', $items[0]['file']);
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ class ItemTest extends TestCase
|
|||
|
||||
$event = Event::create(['slug'=>'EVENT','name'=>'Event']);
|
||||
$box = Container::create(['name'=>'BOX']);
|
||||
$item = Item::create(['cid'=>$box->cid, 'eid' => $event->eid, 'item_uid'=>1, 'wann'=>'', 'wo'=>'','description'=>'1']);
|
||||
$item = Item::create(['cid'=>$box->cid, 'eid' => $event->eid, 'wann'=>'', 'wo'=>'','description'=>'1']);
|
||||
|
||||
$this->assertEquals(1, $item['item_uid']);
|
||||
$this->assertEquals('1', $item['description']);
|
||||
|
@ -122,7 +122,7 @@ class ItemTest extends TestCase
|
|||
$this->assertResponseOk();
|
||||
$this->assertEquals(1, $response['item_uid']);
|
||||
$this->assertEquals('2', $response['description']);
|
||||
//$this->assertEquals($box->name, $response['box']);
|
||||
$this->assertEquals($box->name, $response['box']);
|
||||
$this->assertEquals($box->cid, $response['cid']);
|
||||
//$this->assertEquals('filename', $response['file']);
|
||||
|
||||
|
@ -130,7 +130,7 @@ class ItemTest extends TestCase
|
|||
$this->assertEquals(1, count($items));
|
||||
$this->assertEquals(1, $items[0]['item_uid']);
|
||||
$this->assertEquals('2', $items[0]['description']);
|
||||
//$this->assertEquals($box->name, $items[0]['box']);
|
||||
$this->assertEquals($box->name, $items[0]['box']);
|
||||
$this->assertEquals($box->cid, $items[0]['cid']);
|
||||
//$this->assertEquals('filename', $items[0]['file']);
|
||||
}
|
||||
|
@ -138,8 +138,8 @@ class ItemTest extends TestCase
|
|||
public function testDeleteItem(){
|
||||
$event = Event::create(['slug'=>'EVENT','name'=>'Event']);
|
||||
$box = Container::create(['name'=>'BOX']);
|
||||
$item = Item::create(['cid'=>$box->cid, 'eid' => $event->eid, 'item_uid'=>1, 'wann'=>'', 'wo'=>'','description'=>'1']);
|
||||
Item::create(['cid'=>$box->cid, 'eid' => $event->eid, 'item_uid'=>2, 'wann'=>'', 'wo'=>'','description'=>'2']);
|
||||
$item = Item::create(['cid'=>$box->cid, 'eid' => $event->eid, 'wann'=>'', 'wo'=>'','description'=>'1']);
|
||||
Item::create(['cid'=>$box->cid, 'eid' => $event->eid, 'wann'=>'', 'wo'=>'','description'=>'2']);
|
||||
|
||||
$this->assertEquals(2, count(Item::all()));
|
||||
|
||||
|
@ -149,4 +149,29 @@ class ItemTest extends TestCase
|
|||
$this->assertEquals(1, count(Item::all()));
|
||||
}
|
||||
|
||||
public function testDeleteItem2(){
|
||||
$event = Event::create(['slug'=>'EVENT','name'=>'Event']);
|
||||
$box = Container::create(['name'=>'BOX']);
|
||||
|
||||
$item1 = Item::create(['cid'=>$box->cid, 'eid' => $event->eid, 'wann'=>'', 'wo'=>'','description'=>'1']);
|
||||
$item2 = Item::create(['cid'=>$box->cid, 'eid' => $event->eid, 'wann'=>'', 'wo'=>'','description'=>'2']);
|
||||
|
||||
$this->assertEquals(2, count(Item::all()));
|
||||
|
||||
$this->delete('/1/EVENT/item/'.$item1->item_uid);
|
||||
|
||||
$this->assertResponseOk();
|
||||
$this->assertEquals(1, count(Item::all()));
|
||||
|
||||
$item3 = Item::create(['cid'=>$box->cid, 'eid' => $event->eid, 'wann'=>'', 'wo'=>'','description'=>'3']);
|
||||
|
||||
$this->assertEquals(3, $item3['item_uid']);
|
||||
$this->assertEquals(2, count(Item::all()));
|
||||
|
||||
$this->delete('/1/EVENT/item/'.$item2->item_uid);
|
||||
|
||||
$this->assertResponseOk();
|
||||
$this->assertEquals(1, count(Item::all()));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue