Beispiel #1
0
 public function testSaveDeleteItem()
 {
     $params = (object) array('site' => 'unittest', 'limit' => 1);
     $productManager = new Controller_ExtJS_Product_Default(TestHelper::getContext());
     $result = $productManager->searchItems($params);
     $params = (object) array('site' => 'unittest', 'condition' => (object) array('&&' => array(0 => (object) array('==' => (object) array('product.list.type.domain' => 'text')))), 'start' => 0, 'limit' => 1);
     $productListTypeManager = Controller_ExtJS_Product_List_Type_Factory::createController(TestHelper::getContext());
     $resultType = $productListTypeManager->searchItems($params);
     $saveParams = (object) array('site' => 'unittest', 'items' => (object) array('product.list.parentid' => $result['items'][0]->{'product.id'}, 'product.list.typeid' => $resultType['items'][0]->{'product.list.type.id'}, 'product.list.domain' => 'text', 'product.list.refid' => -1, 'product.list.datestart' => '2000-01-01 00:00:00', 'product.list.dateend' => '2001-01-01 00:00:00', 'product.list.config' => array('test' => 'unit'), 'product.list.position' => 1, 'product.list.status' => 1));
     $searchParams = (object) array('site' => 'unittest', 'condition' => (object) array('&&' => array(0 => (object) array('==' => (object) array('product.list.refid' => -1)))));
     $saved = $this->_object->saveItems($saveParams);
     $searched = $this->_object->searchItems($searchParams);
     $deleteParams = (object) array('site' => 'unittest', 'items' => $saved['items']->{'product.list.id'});
     $this->_object->deleteItems($deleteParams);
     $result = $this->_object->searchItems($searchParams);
     $this->assertInternalType('object', $saved['items']);
     $this->assertNotNull($saved['items']->{'product.list.id'});
     $this->assertEquals($saved['items']->{'product.list.id'}, $searched['items'][0]->{'product.list.id'});
     $this->assertEquals($saved['items']->{'product.list.parentid'}, $searched['items'][0]->{'product.list.parentid'});
     $this->assertEquals($saved['items']->{'product.list.typeid'}, $searched['items'][0]->{'product.list.typeid'});
     $this->assertEquals($saved['items']->{'product.list.domain'}, $searched['items'][0]->{'product.list.domain'});
     $this->assertEquals($saved['items']->{'product.list.refid'}, $searched['items'][0]->{'product.list.refid'});
     $this->assertEquals($saved['items']->{'product.list.datestart'}, $searched['items'][0]->{'product.list.datestart'});
     $this->assertEquals($saved['items']->{'product.list.dateend'}, $searched['items'][0]->{'product.list.dateend'});
     $this->assertEquals($saved['items']->{'product.list.config'}, $searched['items'][0]->{'product.list.config'});
     $this->assertEquals($saved['items']->{'product.list.position'}, $searched['items'][0]->{'product.list.position'});
     $this->assertEquals($saved['items']->{'product.list.status'}, $searched['items'][0]->{'product.list.status'});
     $this->assertEquals(1, count($searched['items']));
     $this->assertEquals(0, count($result['items']));
 }
Beispiel #2
0
 public function testSaveDeleteItem()
 {
     $searchParams = (object) array('site' => 'unittest', 'condition' => (object) array('&&' => array(0 => (object) array('==' => (object) array('product.code' => 'CNC')))));
     $prodCtrl = new Controller_ExtJS_Product_Default(TestHelper::getContext());
     $products = $prodCtrl->searchItems($searchParams);
     $this->assertEquals(1, count($products['items']));
     $searchParams = (object) array('site' => 'unittest', 'condition' => (object) array('&&' => array(0 => (object) array('==' => (object) array('product.property.type.code' => 'package-weight')))));
     $typeCtrl = new Controller_ExtJS_Product_Property_Type_Default(TestHelper::getContext());
     $types = $typeCtrl->searchItems($searchParams);
     $this->assertEquals(1, count($types['items']));
     $saveParams = (object) array('site' => 'unittest', 'items' => (object) array('product.property.parentid' => $products['items'][0]->{'product.id'}, 'product.property.typeid' => $types['items'][0]->{'product.property.type.id'}, 'product.property.languageid' => 'de', 'product.property.value' => 'unittest'));
     $searchParams = (object) array('site' => 'unittest', 'condition' => (object) array('&&' => array(0 => (object) array('==' => (object) array('product.property.value' => 'unittest')))));
     $saved = $this->_object->saveItems($saveParams);
     $searched = $this->_object->searchItems($searchParams);
     $deleteParams = (object) array('site' => 'unittest', 'items' => $saved['items']->{'product.property.id'});
     $this->_object->deleteItems($deleteParams);
     $result = $this->_object->searchItems($searchParams);
     $this->assertInternalType('object', $saved['items']);
     $this->assertNotNull($saved['items']->{'product.property.id'});
     $this->assertEquals($saved['items']->{'product.property.id'}, $searched['items'][0]->{'product.property.id'});
     $this->assertEquals($saved['items']->{'product.property.parentid'}, $searched['items'][0]->{'product.property.parentid'});
     $this->assertEquals($saved['items']->{'product.property.typeid'}, $searched['items'][0]->{'product.property.typeid'});
     $this->assertEquals($saved['items']->{'product.property.languageid'}, $searched['items'][0]->{'product.property.languageid'});
     $this->assertEquals($saved['items']->{'product.property.value'}, $searched['items'][0]->{'product.property.value'});
     $this->assertEquals(1, count($searched['items']));
     $this->assertEquals(0, count($result['items']));
 }