function testFindFirstWithNonSavedOwner_TODO() { $l1 = $this->_createLecture(); $l2 = $this->_createLecture(); $course = $this->_createCourse(array($l1, $l2)); try { $lecture = $course->getLectures()->findFirst(lmbActiveRecord::getDefaultConnection()->quoteIdentifier("id") . "=" . $l1->getId() . " OR " . lmbActiveRecord::getDefaultConnection()->quoteIdentifier("id") . "=" . $l2->getId()); $this->assertTrue(false); } catch (lmbException $e) { } }
function testParentRemovalWithNoCascadeDeleteChildren() { $person = new PersonForTestNoCascadeDelete(); $person->setName('Jim'); $number = $this->creator->initSocialSecurity(); $person->setSocialSecurity($number); $person_id = $person->save(); $this->assertTrue($number_id = $number->getId()); $person->destroy(); $ss2 = lmbActiveRecord::findFirst('SocialSecurityForTest', array('criteria' => lmbActiveRecord::getDefaultConnection()->quoteIdentifier("id") . '= ' . $number_id)); $this->assertEqual($ss2->getCode(), $number->getCode()); }
function testFindFirstWithNonSavedOwner_TODO() { $g1 = $this->_initGroup(); $g2 = $this->_initGroup(); $user = $this->_initUser(array($g1, $g2)); try { $group = $user->getGroups()->findFirst(lmbActiveRecord::getDefaultConnection()->quoteIdentifier("group_id") . "=" . $g1->getId() . " OR " . lmbActiveRecord::getDefaultConnection()->quoteIdentifier("group_id") . "=" . $g2->getId()); $this->assertTrue(false); } catch (lmbException $e) { } }
function testDeleteCollection() { $course = $this->_initCourse(); $l1 = new LectureForTest(); $l1->setTitle('Physics'); $l2 = new LectureForTest(); $l2->setTitle('Math'); $course->addToLectures($l1); $course->addToLectures($l2); $course->save(); $course2 = lmbActiveRecord::findById('CourseForTest', $course->getId()); $course2->destroy(); $this->assertNull(lmbActiveRecord::findFirst('LectureForTest', array('criteria' => lmbActiveRecord::getDefaultConnection()->quoteIdentifier("id") . '= ' . $l1->getId()))); $this->assertNull(lmbActiveRecord::findFirst('LectureForTest', array('criteria' => lmbActiveRecord::getDefaultConnection()->quoteIdentifier("id") . '= ' . $l2->getId()))); }
function testUpdateShortRawWithCriteria() { $object1 = $this->creator->createOneTableObject(); $object2 = $this->creator->createOneTableObject(); TestOneTableObject::updateRaw(array('content' => 'blah'), lmbActiveRecord::getDefaultConnection()->quoteIdentifier("id") . '=' . $object2->getId()); $rs = TestOneTableObject::find(); $rs->rewind(); $this->assertEqual($rs->current()->getContent(), $object1->getContent()); $rs->next(); $this->assertEqual($rs->current()->getContent(), 'blah'); $rs->next(); $this->assertFalse($rs->valid()); }