6
6
7
7
final class DrupalIntegrationTest extends AnalyzerTestBase {
8
8
9
+ // @todo move to generic autoloading test.
9
10
public function testInstallPhp (): void
10
11
{
11
12
$ errors = $ this ->runAnalyze (__DIR__ . '/../fixtures/drupal/core/install.php ' );
12
13
$ this ->assertCount (0 , $ errors ->getErrors ());
13
14
$ this ->assertCount (0 , $ errors ->getInternalErrors ());
14
15
}
15
16
17
+ // @todo move to generic autoloading test.
16
18
public function testTestSuiteAutoloading () {
17
19
$ paths = [
18
20
__DIR__ . '/../fixtures/drupal/core/tests/TestSuites/FunctionalJavascriptTestSuite.php ' ,
@@ -34,12 +36,14 @@ public function testTestSuiteAutoloading() {
34
36
self ::assertCount (0 , $ errors ->getInternalErrors (), print_r ($ errors ->getInternalErrors (), true ));
35
37
}
36
38
39
+ // @todo move to generic autoloading test.
37
40
public function testDrupalTestInChildSiteContant () {
38
41
$ errors = $ this ->runAnalyze (__DIR__ . '/../fixtures/drupal/modules/phpstan_fixtures/src/DrupalTestInChildSiteContant.php ' );
39
42
$ this ->assertCount (0 , $ errors ->getErrors ());
40
43
$ this ->assertCount (0 , $ errors ->getInternalErrors ());
41
44
}
42
45
46
+ // @todo move to generic autoloading test.
43
47
public function testExtensionReportsError (): void
44
48
{
45
49
$ is_d9 = version_compare ('9.0.0 ' , \Drupal::VERSION ) !== 1 ;
@@ -62,6 +66,7 @@ public function testExtensionReportsError(): void
62
66
self ::assertNotFalse (strpos ($ error ->getMessage (), 'phpstan_fixtures/phpstan_fixtures.fetch.inc could not be loaded from Drupal \\Core \\Extension \\ModuleHandlerInterface::loadInclude ' ));
63
67
}
64
68
69
+ // @todo move to generic autoloading test.
65
70
public function testExtensionTestSuiteAutoloading (): void
66
71
{
67
72
$ paths = [
@@ -79,46 +84,7 @@ public function testExtensionTestSuiteAutoloading(): void
79
84
}
80
85
}
81
86
82
- public function testServiceMapping8 ()
83
- {
84
- if (version_compare ('9.0.0 ' , \Drupal::VERSION ) !== 1 ) {
85
- self ::markTestSkipped ('Only tested on Drupal 8.x.x ' );
86
- }
87
- $ errorMessages = [
88
- 'The "entity.manager" service is deprecated. You should use the \'entity_type.manager \' service instead. ' ,
89
- 'Call to an undefined method Drupal\Core\Entity\EntityManager::thisMethodDoesNotExist(). ' ,
90
- 'Call to deprecated method getDefinitions() of class Drupal \\Core \\Entity \\EntityManager:
91
- in drupal:8.0.0 and is removed from drupal:9.0.0.
92
- Use \\Drupal \\Core \\Entity \\EntityTypeManagerInterface::getDefinitions()
93
- instead. ' ,
94
- 'The "path.alias_manager" service is deprecated. Use "path_alias.manager" instead. See https://drupal.org/node/3092086 ' ,
95
- ];
96
- $ errors = $ this ->runAnalyze (__DIR__ . '/../fixtures/drupal/modules/phpstan_fixtures/src/TestServicesMappingExtension.php ' );
97
- self ::assertCount (count ($ errorMessages ), $ errors ->getErrors ());
98
- self ::assertCount (0 , $ errors ->getInternalErrors ());
99
- foreach ($ errors ->getErrors () as $ key => $ error ) {
100
- self ::assertEquals ($ errorMessages [$ key ], $ error ->getMessage ());
101
- }
102
- }
103
-
104
- public function testServiceMapping9 ()
105
- {
106
- if (version_compare ('9.0.0 ' , \Drupal::VERSION ) === 1 ) {
107
- self ::markTestSkipped ('Only tested on Drupal 9.x.x ' );
108
- }
109
- // @todo: the actual error should be the fact `entity.manager` does not exist.
110
- $ errorMessages = [
111
- '\Drupal calls should be avoided in classes, use dependency injection instead ' ,
112
- '\Drupal calls should be avoided in classes, use dependency injection instead ' ,
113
- ];
114
- $ errors = $ this ->runAnalyze (__DIR__ . '/../fixtures/drupal/modules/phpstan_fixtures/src/TestServicesMappingExtension.php ' );
115
- self ::assertCount (count ($ errorMessages ), $ errors ->getErrors ());
116
- self ::assertCount (0 , $ errors ->getInternalErrors ());
117
- foreach ($ errors ->getErrors () as $ key => $ error ) {
118
- self ::assertEquals ($ errorMessages [$ key ], $ error ->getMessage ());
119
- }
120
- }
121
-
87
+ // @todo move to ???
122
88
public function testAppRootPseudoService () {
123
89
$ is_d9 = version_compare ('9.0.0 ' , \Drupal::VERSION ) !== 1 ;
124
90
$ errors = $ this ->runAnalyze (__DIR__ . '/../fixtures/drupal/modules/phpstan_fixtures/src/AppRootParameter.php ' );
@@ -136,12 +102,14 @@ public function testAppRootPseudoService() {
136
102
}
137
103
}
138
104
105
+ // @todo move to generic autoloading test.
139
106
public function testThemeSettingsFile () {
140
107
$ errors = $ this ->runAnalyze (__DIR__ . '/../fixtures/drupal/core/modules/system/tests/themes/test_theme_settings/theme-settings.php ' );
141
108
$ this ->assertCount (0 , $ errors ->getErrors (), var_export ($ errors , TRUE ));
142
109
$ this ->assertCount (0 , $ errors ->getInternalErrors (), var_export ($ errors , TRUE ));
143
110
}
144
111
112
+ // @todo needs to be a test for ModuleLoadInclude
145
113
public function testModuleLoadInclude () {
146
114
$ errors = $ this ->runAnalyze (__DIR__ . '/../fixtures/drupal/modules/module_load_include_fixture/module_load_include_fixture.module ' );
147
115
$ this ->assertCount (0 , $ errors ->getErrors (), var_export ($ errors , TRUE ));
0 commit comments