Changeset View
Changeset View
Standalone View
Standalone View
testprovider/phpunitrunjob.cpp
Show All 23 Lines | |||||
24 | #include "testproviderdebug.h" | 24 | #include "testproviderdebug.h" | ||
25 | 25 | | |||
26 | #include <QStandardPaths> | 26 | #include <QStandardPaths> | ||
27 | 27 | | |||
28 | #include <util/processlinemaker.h> | 28 | #include <util/processlinemaker.h> | ||
29 | #include <util/executecompositejob.h> | 29 | #include <util/executecompositejob.h> | ||
30 | #include <outputview/outputmodel.h> | 30 | #include <outputview/outputmodel.h> | ||
31 | #include <interfaces/itestcontroller.h> | 31 | #include <interfaces/itestcontroller.h> | ||
32 | #include <interfaces/iruncontroller.h> | ||||
32 | #include <interfaces/icore.h> | 33 | #include <interfaces/icore.h> | ||
33 | #include <interfaces/ilauncher.h> | 34 | #include <interfaces/ilauncher.h> | ||
34 | #include <interfaces/ilaunchconfiguration.h> | 35 | #include <interfaces/ilaunchconfiguration.h> | ||
35 | #include <interfaces/launchconfigurationtype.h> | 36 | #include <interfaces/launchconfigurationtype.h> | ||
36 | #include <interfaces/ilaunchmode.h> | 37 | #include <interfaces/ilaunchmode.h> | ||
37 | 38 | | |||
38 | #include <KProcess> | 39 | #include <KProcess> | ||
39 | #include <KLocalizedString> | 40 | #include <KLocalizedString> | ||
40 | #include <KConfigGroup> | 41 | #include <KConfigGroup> | ||
41 | 42 | | |||
42 | PhpUnitRunJob::PhpUnitRunJob(PhpUnitTestSuite* suite, const QStringList& cases, KDevelop::OutputJob::OutputJobVerbosity verbosity, QObject* parent) | 43 | PhpUnitRunJob::PhpUnitRunJob(PhpUnitTestSuite* suite, const QStringList& cases, KDevelop::OutputJob::OutputJobVerbosity verbosity, QObject* parent) | ||
43 | : KJob(parent) | 44 | : KJob(parent) | ||
44 | , m_process(0) | 45 | , m_process(nullptr) | ||
45 | , m_suite(suite) | 46 | , m_suite(suite) | ||
46 | , m_cases(cases) | 47 | , m_cases(cases) | ||
47 | , m_job(0) | 48 | , m_job(nullptr) | ||
48 | , m_outputJob(0) | 49 | , m_outputJob(nullptr) | ||
49 | , m_verbosity(verbosity) | 50 | , m_verbosity(verbosity) | ||
50 | { | 51 | { | ||
51 | } | 52 | } | ||
52 | 53 | | |||
53 | KJob* createTestJob(QString launchModeId, QStringList arguments ) | 54 | KJob* createTestJob(QString launchModeId, QStringList arguments ) | ||
54 | { | 55 | { | ||
55 | KDevelop::LaunchConfigurationType* type = KDevelop::ICore::self()->runController()->launchConfigurationTypeForId( QStringLiteral("Script Application") ); | 56 | KDevelop::LaunchConfigurationType* type = KDevelop::ICore::self()->runController()->launchConfigurationTypeForId( QStringLiteral("Script Application") ); | ||
56 | KDevelop::ILaunchMode* mode = KDevelop::ICore::self()->runController()->launchModeForId( launchModeId ); | 57 | KDevelop::ILaunchMode* mode = KDevelop::ICore::self()->runController()->launchModeForId( launchModeId ); | ||
57 | 58 | | |||
58 | qCDebug(TESTPROVIDER) << "got mode and type:" << type << type->id() << mode << mode->id(); | 59 | qCDebug(TESTPROVIDER) << "got mode and type:" << type << type->id() << mode << mode->id(); | ||
59 | Q_ASSERT(type && mode); | 60 | Q_ASSERT(type && mode); | ||
60 | 61 | | |||
61 | KDevelop::ILauncher* launcher = 0; | 62 | KDevelop::ILauncher* launcher = nullptr; | ||
62 | foreach (KDevelop::ILauncher *l, type->launchers()) | 63 | foreach (KDevelop::ILauncher *l, type->launchers()) | ||
63 | { | 64 | { | ||
64 | //qCDebug(TESTPROVIDER) << "available launcher" << l << l->id() << l->supportedModes(); | 65 | //qCDebug(TESTPROVIDER) << "available launcher" << l << l->id() << l->supportedModes(); | ||
65 | if (l->supportedModes().contains(mode->id())) { | 66 | if (l->supportedModes().contains(mode->id())) { | ||
66 | launcher = l; | 67 | launcher = l; | ||
67 | break; | 68 | break; | ||
68 | } | 69 | } | ||
69 | } | 70 | } | ||
70 | Q_ASSERT(launcher); | 71 | Q_ASSERT(launcher); | ||
71 | 72 | | |||
72 | KDevelop::ILaunchConfiguration* ilaunch = 0; | 73 | KDevelop::ILaunchConfiguration* ilaunch = nullptr; | ||
73 | QList<KDevelop::ILaunchConfiguration*> launchConfigurations = KDevelop::ICore::self()->runController()->launchConfigurations(); | 74 | QList<KDevelop::ILaunchConfiguration*> launchConfigurations = KDevelop::ICore::self()->runController()->launchConfigurations(); | ||
74 | foreach (KDevelop::ILaunchConfiguration *l, launchConfigurations) { | 75 | foreach (KDevelop::ILaunchConfiguration *l, launchConfigurations) { | ||
75 | if (l->type() == type && l->config().readEntry("ConfiguredByPhpUnit", false)) { | 76 | if (l->type() == type && l->config().readEntry("ConfiguredByPhpUnit", false)) { | ||
76 | ilaunch = l; | 77 | ilaunch = l; | ||
77 | break; | 78 | break; | ||
78 | } | 79 | } | ||
79 | } | 80 | } | ||
80 | if (!ilaunch) { | 81 | if (!ilaunch) { | ||
81 | ilaunch = KDevelop::ICore::self()->runController()->createLaunchConfiguration( type, | 82 | ilaunch = KDevelop::ICore::self()->runController()->createLaunchConfiguration( type, | ||
82 | qMakePair( mode->id(), launcher->id() ), | 83 | qMakePair( mode->id(), launcher->id() ), | ||
83 | 0, //TODO add project | 84 | nullptr, //TODO add project | ||
84 | i18n("PHPUnit") ); | 85 | i18n("PHPUnit") ); | ||
85 | ilaunch->config().writeEntry("ConfiguredByPhpUnit", true); | 86 | ilaunch->config().writeEntry("ConfiguredByPhpUnit", true); | ||
86 | //qCDebug(TESTPROVIDER) << "created config, launching"; | 87 | //qCDebug(TESTPROVIDER) << "created config, launching"; | ||
87 | } else { | 88 | } else { | ||
88 | //qCDebug(TESTPROVIDER) << "reusing generated config, launching"; | 89 | //qCDebug(TESTPROVIDER) << "reusing generated config, launching"; | ||
89 | } | 90 | } | ||
90 | type->configureLaunchFromCmdLineArguments( ilaunch->config(), arguments ); | 91 | type->configureLaunchFromCmdLineArguments( ilaunch->config(), arguments ); | ||
91 | return KDevelop::ICore::self()->runController()->execute(launchModeId, ilaunch); | 92 | return KDevelop::ICore::self()->runController()->execute(launchModeId, ilaunch); | ||
▲ Show 20 Lines • Show All 109 Lines • Show Last 20 Lines |