@@ -62,7 +62,7 @@ final class ComponentInstallerTest extends TestCase
6262 /** @var InstallationManager&MockObject */
6363 private $ installationManager ;
6464
65- /** @var array{laminas?:array{component-auto-installs?:list<non-empty-string>,component-whitelist?:list<non-empty-string> }} */
65+ /** @var array{laminas?:array{component-auto-installs?:list<non-empty-string>}} */
6666 private $ rootPackageExtra = [];
6767
6868 protected function setUp (): void
@@ -1735,177 +1735,6 @@ public function testInstallAutoInstallableDevModuleWithUniqueInjector(): void
17351735 ], $ modules );
17361736 }
17371737
1738- public function testInstallDeprecatedWhitelistedDevModuleWithDifferentInjectors (): void
1739- {
1740- $ moduleConfigContent = <<<'CONFIG'
1741- <?php
1742- return [
1743- 'modules' => [
1744- 'Laminas\Router',
1745- 'Laminas\Validator',
1746- 'Application'
1747- ]
1748- ];
1749- CONFIG;
1750-
1751- $ this ->createConfigFile ('modules.config.php ' , $ moduleConfigContent );
1752-
1753- $ configContents = <<<'CONFIG'
1754- <?php
1755- return [
1756- 'modules' => [
1757- ]
1758- ];
1759- CONFIG;
1760- foreach (['development.config.php.dist ' , 'development.config.php ' ] as $ configName ) {
1761- $ this ->createConfigFile ($ configName , $ configContents );
1762- }
1763-
1764- $ this ->rootPackage ->method ('getDevRequires ' )->willReturn (['some/component ' => '* ' ]);
1765- $ this ->rootPackageExtra = [
1766- 'laminas ' => [
1767- "component-whitelist " => [
1768- "some/component " ,
1769- ],
1770- ],
1771- ];
1772-
1773- $ package = $ this ->createMock (PackageInterface::class);
1774- $ package ->method ('getName ' )->willReturn ('some/component ' );
1775- $ package ->method ('getExtra ' )->willReturn ([
1776- 'laminas ' => [
1777- 'component ' => [
1778- 'Some \\Component ' ,
1779- ],
1780- ],
1781- ]);
1782-
1783- $ operation = $ this ->createMock (InstallOperation::class);
1784- $ operation ->method ('getPackage ' )->willReturn ($ package );
1785-
1786- $ event = $ this ->createMock (PackageEvent::class);
1787- $ event ->method ('isDevMode ' )->willReturn (true );
1788- $ event ->method ('getOperation ' )->willReturn ($ operation );
1789- $ this ->prepareEventForPackageProviderDetection ($ event , 'some/component ' );
1790-
1791- $ this ->installer ->onPostPackageInstall ($ event );
1792- /**
1793- * @psalm-suppress UnresolvableInclude
1794- * @psalm-var array{modules:list<non-empty-string>} $config
1795- */
1796- $ config = require vfsStream::url ('project/config/modules.config.php ' );
1797- $ modules = $ config ['modules ' ];
1798- self ::assertEquals ([
1799- 'Laminas\Router ' ,
1800- 'Laminas\Validator ' ,
1801- 'Application ' ,
1802- ], $ modules );
1803- /**
1804- * @psalm-suppress UnresolvableInclude
1805- * @psalm-var array{modules:list<non-empty-string>} $config
1806- */
1807- $ config = require vfsStream::url ('project/config/development.config.php ' );
1808- $ modules = $ config ['modules ' ];
1809- self ::assertEquals (['Some\Component ' ], $ modules );
1810- }
1811-
1812- public function testOnPostPackageInstallDoesNotPromptForDeprecatedWhitelistedPackages (): void
1813- {
1814- $ this ->createApplicationConfig ();
1815-
1816- $ package = $ this ->createMock (PackageInterface::class);
1817- $ package ->method ('getName ' )->willReturn ('some/component ' );
1818- $ package ->method ('getExtra ' )->willReturn ([
1819- 'laminas ' => [
1820- 'component ' => 'Some \\Component ' ,
1821- ],
1822- ]);
1823-
1824- $ operation = $ this ->createMock (InstallOperation::class);
1825- $ operation ->method ('getPackage ' )->willReturn ($ package );
1826-
1827- $ event = $ this ->createMock (PackageEvent::class);
1828- $ event ->method ('isDevMode ' )->willReturn (true );
1829- $ event ->method ('getOperation ' )->willReturn ($ operation );
1830- $ this ->prepareEventForPackageProviderDetection ($ event , 'some/component ' );
1831-
1832- $ this ->rootPackage ->method ('getName ' )->willReturn ('some/component ' );
1833- $ this ->rootPackageExtra = [
1834- 'laminas ' => [
1835- 'component-whitelist ' => ['some/component ' ],
1836- ],
1837- ];
1838-
1839- $ this ->createOutputAssertions ([
1840- 'Installing Some\Component from package some/component ' ,
1841- ]);
1842- $ this ->io
1843- ->expects (self ::never ())
1844- ->method ('ask ' );
1845-
1846- $ this ->installer ->onPostPackageInstall ($ event );
1847- $ config = file_get_contents (vfsStream::url ('project/config/application.config.php ' ));
1848- self ::assertStringContainsString ("'Some\Component' " , $ config );
1849- }
1850-
1851- public function testInstallDeprecatedWhitelistedDevModuleWithUniqueInjector (): void
1852- {
1853- $ moduleConfigContent = <<<'CONFIG'
1854- <?php
1855- return [
1856- 'modules' => [
1857- 'Laminas\Router',
1858- 'Laminas\Validator',
1859- 'Application',
1860- ]
1861- ];
1862- CONFIG;
1863-
1864- $ this ->createConfigFile ('modules.config.php ' , $ moduleConfigContent );
1865-
1866- $ this ->rootPackageExtra = [
1867- 'laminas ' => [
1868- "component-whitelist " => [
1869- "some/module " ,
1870- ],
1871- ],
1872- ];
1873-
1874- $ package = $ this ->createMock (PackageInterface::class);
1875- $ package ->method ('getName ' )->willReturn ('some/module ' );
1876- $ package ->method ('getExtra ' )->willReturn ([
1877- 'laminas ' => [
1878- 'module ' => 'Some \\Module ' ,
1879- ],
1880- ]);
1881-
1882- $ operation = $ this ->createMock (InstallOperation::class);
1883- $ operation ->method ('getPackage ' )->willReturn ($ package );
1884-
1885- $ event = $ this ->createMock (PackageEvent::class);
1886- $ event ->method ('isDevMode ' )->willReturn (true );
1887- $ event ->method ('getOperation ' )->willReturn ($ operation );
1888- $ this ->prepareEventForPackageProviderDetection ($ event , 'some/module ' );
1889-
1890- $ this ->rootPackage
1891- ->method ('getName ' )
1892- ->willReturn ('some/module ' );
1893-
1894- $ this ->installer ->onPostPackageInstall ($ event );
1895- /**
1896- * @psalm-suppress UnresolvableInclude
1897- * @psalm-var array{modules:list<non-empty-string>} $config
1898- */
1899- $ config = require vfsStream::url ('project/config/modules.config.php ' );
1900- $ modules = $ config ['modules ' ];
1901- self ::assertEquals ([
1902- 'Laminas\Router ' ,
1903- 'Laminas\Validator ' ,
1904- 'Application ' ,
1905- 'Some\Module ' ,
1906- ], $ modules );
1907- }
1908-
19091738 /**
19101739 * @return array<non-empty-string,array{
19111740 * non-empty-string,
0 commit comments