Example #1
0
 public function testSaveDeleteItem()
 {
     $params = (object) array('site' => 'unittest', 'limit' => 1);
     $textManager = new Controller_ExtJS_Text_Default(TestHelper::getContext());
     $result = $textManager->searchItems($params);
     $params = (object) array('site' => 'unittest', 'condition' => (object) array('&&' => array(0 => (object) array('==' => (object) array('text.list.type.domain' => 'text')))), 'start' => 0, 'limit' => 1);
     $textListTypeManager = Controller_ExtJS_Text_List_Type_Factory::createController(TestHelper::getContext());
     $resultType = $textListTypeManager->searchItems($params);
     $saveParams = (object) array('site' => 'unittest', 'items' => (object) array('text.list.parentid' => $result['items'][0]->{'text.id'}, 'text.list.typeid' => $resultType['items'][0]->{'text.list.type.id'}, 'text.list.domain' => 'text', 'text.list.refid' => 123, 'text.list.datestart' => '2000-01-01 00:00:00', 'text.list.dateend' => '2001-01-01 00:00:00', 'text.list.config' => array('test' => 'unit'), 'text.list.position' => 1, 'text.list.status' => 1));
     $searchParams = (object) array('site' => 'unittest', 'condition' => (object) array('&&' => array(0 => (object) array('==' => (object) array('text.list.refid' => 123)))));
     $saved = $this->_object->saveItems($saveParams);
     $searched = $this->_object->searchItems($searchParams);
     $deleteParams = (object) array('site' => 'unittest', 'items' => $saved['items']->{'text.list.id'});
     $this->_object->deleteItems($deleteParams);
     $result = $this->_object->searchItems($searchParams);
     $this->assertInternalType('object', $saved['items']);
     $this->assertNotNull($saved['items']->{'text.list.id'});
     $this->assertEquals($saved['items']->{'text.list.id'}, $searched['items'][0]->{'text.list.id'});
     $this->assertEquals($saved['items']->{'text.list.parentid'}, $searched['items'][0]->{'text.list.parentid'});
     $this->assertEquals($saved['items']->{'text.list.typeid'}, $searched['items'][0]->{'text.list.typeid'});
     $this->assertEquals($saved['items']->{'text.list.domain'}, $searched['items'][0]->{'text.list.domain'});
     $this->assertEquals($saved['items']->{'text.list.refid'}, $searched['items'][0]->{'text.list.refid'});
     $this->assertEquals($saved['items']->{'text.list.datestart'}, $searched['items'][0]->{'text.list.datestart'});
     $this->assertEquals($saved['items']->{'text.list.dateend'}, $searched['items'][0]->{'text.list.dateend'});
     $this->assertEquals($saved['items']->{'text.list.config'}, $searched['items'][0]->{'text.list.config'});
     $this->assertEquals($saved['items']->{'text.list.position'}, $searched['items'][0]->{'text.list.position'});
     $this->assertEquals($saved['items']->{'text.list.status'}, $searched['items'][0]->{'text.list.status'});
     $this->assertEquals(1, count($searched['items']));
     $this->assertEquals(0, count($result['items']));
 }
Example #2
0
 public function testFactoryExceptionWrongInterface()
 {
     $this->setExpectedException('Controller_ExtJS_Exception');
     Controller_ExtJS_Text_List_Type_Factory::createController(TestHelper::getContext(), 'Factory');
 }