Revision 4062c152
Von Christian Ehringfeld vor fast 10 Jahren hinzugefügt
| tests/em/tst_em.cpp | ||
|---|---|---|
|
|
||
|
private:
|
||
|
CuteEntityManager::EntityManager *e;
|
||
|
void createRelationTables();
|
||
|
void deleteRelationTables();
|
||
|
};
|
||
|
|
||
|
Em::Em() {
|
||
| ... | ... | |
|
}
|
||
|
|
||
|
void Em::testRelationTableCreation() {
|
||
|
QStringList relationTables = QStringList() << "Employee" << "WorkerGroup";
|
||
|
QVERIFY2(this->e->startup("emTestB", relationTables), "Failure");
|
||
|
this->createRelationTables();
|
||
|
auto tableNames = this->e->getSchema()->getTableNames();
|
||
|
QVERIFY(tableNames.contains("workergroup"));
|
||
|
QVERIFY(tableNames.contains("employee"));
|
||
| ... | ... | |
|
auto migrations = this->e->findAll<CuteEntityManager::DatabaseMigration>();
|
||
|
QCOMPARE(migrations.size(), 2);
|
||
|
QCOMPARE(migrations.at(1)->getVersion(), QString("emTestB"));
|
||
|
this->deleteRelationTables();
|
||
|
}
|
||
|
|
||
|
void Em::createRelationTables() {
|
||
|
QStringList relationTables = QStringList() << "Employee" << "WorkerGroup";
|
||
|
QVERIFY2(this->e->startup("emTestB", relationTables), "Failure");
|
||
|
}
|
||
|
|
||
|
void Em::deleteRelationTables() {
|
||
|
auto qb = this->e->getQueryBuilder();
|
||
|
QVERIFY(this->e->executeQuery(qb->dropTable("workergroup_workers")));
|
||
|
QVERIFY(this->e->executeQuery(qb->dropTable("employee")));
|
||
Auch abrufbar als: Unified diff
new methods