Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 2bc42f53

Von Christian Ehringfeld vor fast 6 Jahren hinzugefügt

  • ID 2bc42f5350b209cd4da1c729825b0b4baf994797
  • Vorgänger e7846d55
  • Nachfolger 3da0a096

imp test

Unterschiede anzeigen:

tests/em/tst_em.cpp
CuteEntityManager::EntityInstanceFactory::registerClass<Article>();
CuteEntityManager::EntityInstanceFactory::registerClass<Employee>();
CuteEntityManager::EntityInstanceFactory::registerClass<WorkerGroup>();
this->e = new CuteEntityManager::EntityManager("QSQLITE",
":memory:", "", "", "", "", true, "foreign_keys = ON", false,MsgType::DEBUG);
QStringList inits = QStringList() << "Article" << "Group" << "Person" << "Employee" << "WorkerGroup";
e->startup("0.1", inits);
}
CuteEntityManager::EntityInstanceFactory::registerClass<TestPerson>();
CuteEntityManager::EntityInstanceFactory::registerClass<TestPupil>();
CuteEntityManager::EntityInstanceFactory::registerClass<TestGroup>();
CuteEntityManager::EntityInstanceFactory::registerClass<TestPupilChild>();
CuteEntityManager::EntityInstanceFactory::registerClass<TestPupilGrandChild>();
}
void EmTest::cleanupTestCase() {
if (this->e) {
......
}
}
void EmTest::testChainedHeritageCreate() {
// QList<QSharedPointer<TestGroup>> groups;
// QList<QSharedPointer<TestPerson>> childListAAA;
// QList<QSharedPointer<TestPerson>> grandChildListBBB;
// QList<QSharedPointer<TestPerson>> greatGrandChildListCCC;
void EmTest::init() {
this->e = new CuteEntityManager::EntityManager("QSQLITE",
":memory:", "", "", "", "", true, "foreign_keys = ON", false);
QStringList inits = QStringList() << "Person" << "Group" << "Article" << "TestPerson" << "TestPupil" << "TestGroup" << "TestPupilChild" << "TestPupilGrandChild";
QVERIFY2(this->e->startup("emTestA", inits), "Failure");
auto migrations = this->e->findAll<CuteEntityManager::DatabaseMigration>();
QCOMPARE(migrations.size(), 1);
QCOMPARE(migrations.at(0)->getVersion(), QString("emTestA"));
}
void EmTest::testChainedHeritageCreate() {
auto testPerson = QSharedPointer<TestPerson>(new TestPerson());
auto testPupil = QSharedPointer<TestPupil>(new TestPupil());
auto testPupilChild = QSharedPointer<TestPupilChild>(new TestPupilChild());
......
QCOMPARE(this->e->count("article"), (quint32)0);
}
void EmTest::init() {
CuteEntityManager::EntityInstanceFactory::registerClass<Group>();
CuteEntityManager::EntityInstanceFactory::registerClass<Person>();
CuteEntityManager::EntityInstanceFactory::registerClass<Article>();
CuteEntityManager::EntityInstanceFactory::registerClass<Employee>();
CuteEntityManager::EntityInstanceFactory::registerClass<WorkerGroup>();
this->e = new CuteEntityManager::EntityManager("QSQLITE",
":memory:", "", "", "", "", true, "foreign_keys = ON", false);
QStringList inits = QStringList() << "Person" << "Group" << "Article";
QVERIFY2(this->e->startup("emTestA", inits), "Failure");
auto migrations = this->e->findAll<CuteEntityManager::DatabaseMigration>();
QCOMPARE(migrations.size(), 1);
QCOMPARE(migrations.at(0)->getVersion(), QString("emTestA"));
}
void EmTest::testDatabaseMigrationTable() {
auto tables = this->e->getSchema()->getTables();
QString tblName = "cuteentitymanager::databasemigration";

Auch abrufbar als: Unified diff