function testResolveDbTableFileFailed() { die_on_error(false); $this->resolver->resolve('no_such_db_table'); $this->assertTrue(catch_error('LimbException', $e)); die_on_error(); }
function testResolveDataMapperFileFailed() { die_on_error(false); $this->resolver->resolve('no_such_mapper'); $this->assertTrue(catch_error('LimbException', $e)); die_on_error(); }
function testResolveObjectFileFailed() { die_on_error(false); $this->resolver->resolve('no_such_object'); $this->assertTrue(catch_error('LimbException', $e)); die_on_error(); }
function testGetRequestedService404IfNoIni() { $toolkit =& Limb :: toolkit(); $request = $toolkit->getRequest(); $resolver = new IniBasedServiceRequestResolver(); die_on_error(false); $service = $resolver->resolve($request); die_on_error(); $this->assertTrue(catch_error('LimbException', $e)); }
function testResolveStringsFileFailed() { die_on_error(false); $this->resolver->resolve('no_such_strings_file', array('fr')); $this->assertTrue(catch_error('LimbException', $e)); $this->assertEqual($e->getAdditionalParams(), array( 'file_path' => 'i18n/no_such_strings_file_fr.ini', )); die_on_error(); }
function testFailedInsertNoOId() { $object = new ServiceLocation(); $mapper = new ServiceLocationMapper(); die_on_error(false); $mapper->insert($object); die_on_error(); $this->assertTrue(catch_error('LimbException', $e)); $this->assertEqual($e->getMessage(), 'oid is not set'); }
function testPerformFailedNoView() { $command = new DisplayViewCommand(); $this->toolkit->expectOnce('getView'); $this->toolkit->setReturnValue('getView', null); die_on_error(false); $command->perform(); $this->assertTrue(catch_error('LimbException', $e)); die_on_error(); }
function testFailedInsertNoObjectId() { $object = new NodeConnection(); $object->set('oid', 10); $mapper = new NodeConnectionMapper(); die_on_error(false); $mapper->insert($object); die_on_error(); $this->assertTrue(catch_error('LimbException', $e)); $this->assertEqual($e->getMessage(), 'node id is not set'); }
function resolve($file_path, $params = array()) { $toolkit =& Limb :: toolkit(); $ini =& $toolkit->getINI('common.ini'); $tmpl_path = $ini->getOption('templates_path', 'Templates'); $shared_tmpl_path = $ini->getOption('shared_templates_path', 'Templates'); $locale = $this->_getLocalePrefix(); if(file_exists($tmpl_path . $locale . $file_path)) return $tmpl_path . $locale . $file_path; if(file_exists($tmpl_path . $file_path)) return $tmpl_path . $file_path; die_on_error(false); $res = $this->_resolver->resolve('design/' . $locale . $file_path, $params); if(catch_error('LimbException', $e)) $res = $this->_resolver->resolve('design/' . $file_path, $params); if(catch_error('LimbException', $e)) { if(file_exists($shared_tmpl_path . $locale . $file_path)) return $shared_tmpl_path . $locale . $file_path; if(file_exists($shared_tmpl_path . $file_path)) return $shared_tmpl_path . $file_path; throw_error($e); } die_on_error(); return $res; }
function testResolveTemplateFileFailed() { die_on_error(false); $this->resolver->resolve('no_such_template.html'); $this->assertTrue(catch_error('LimbException', $e)); die_on_error(); }
function testDeleteNew() { $obj = new UOWTestObject(); die_on_error(false); $this->uow->delete($obj); die_on_error(); $this->assertTrue(catch_error('LimbException', $e)); $this->mapper->expectNever('delete'); $this->uow->commit(); }
function testStateWithBrokenTransitions() { $factory = new MockCommandsFactory($this); $state_machine = new StateMachineCommand($factory); $state_machine->registerState('Initial', array('some_result' => 'NoSuchState')); $state_machine->registerState('NextState'); $state_machine->registerState('ExtraState'); $factory->expectOnce('performInitial'); $factory->setReturnValueAt(0, 'performInitial', 'some_result'); $factory->expectNever('performNextState'); $factory->expectNever('performExtraState'); die_on_error(false); $state_machine->perform(); $this->assertTrue(catch_error('LimbException', $e)); die_on_error(); }
function testCantDeleteNoNodeId() { $mapper = new TreeNodeDataMapper(); $object = new Object(); die_on_error(false); $mapper->delete($object); die_on_error(); $this->assertTrue(catch_error('LimbException', $e)); $this->assertEqual($e->getMessage(), 'node id not set'); }
function testSetupTargetsFailedNoSuchRuntimeTarget() { $component = new LimbDAOComponentSetupTargetsTestVersion($this); $component->parent = $this->parent; $this->parent->expectArgumentsAt(0, 'findChild', array('target1')); $this->parent->setReturnValueAt(0, 'findChild', null); $component->expectOnce('getDataset'); $dataset = new PagedArrayDataset(array('some_data')); $component->setReturnReference('getDataset', $dataset); $component->setTargets('target1, target2'); die_on_error(false); $component->process(); die_on_error(); $this->assertTrue(catch_error('LimbException', $e)); $component->tally(); }