Skip to content

Commit d76acc2

Browse files
authored
Merge pull request #5953 from magento-trigger/MC-34427
[Trigger] Remove google-shopping-ads module and cleanup travis configuration
2 parents b4770e4 + 3521b44 commit d76acc2

File tree

22 files changed

+537
-153
lines changed

22 files changed

+537
-153
lines changed

.github/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ For more detailed information on contribution please read our [beginners guide](
2323
* Unit/integration test coverage
2424
* Proposed [documentation](https://devdocs.magento.com) updates. Documentation contributions can be submitted via the [devdocs GitHub](https://github.com/magento/devdocs).
2525
4. For larger features or changes, please [open an issue](https://github.com/magento/magento2/issues) to discuss the proposed changes prior to development. This may prevent duplicate or unnecessary effort and allow other contributors to provide input.
26-
5. All automated tests must pass (all builds on [Travis CI](https://travis-ci.org/magento/magento2) must be green).
26+
5. All automated tests must pass.
2727

2828
## Contribution process
2929

.htaccess

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -238,15 +238,6 @@
238238
Require all denied
239239
</IfVersion>
240240
</Files>
241-
<Files .travis.yml>
242-
<IfVersion < 2.4>
243-
order allow,deny
244-
deny from all
245-
</IfVersion>
246-
<IfVersion >= 2.4>
247-
Require all denied
248-
</IfVersion>
249-
</Files>
250241
<Files CHANGELOG.md>
251242
<IfVersion < 2.4>
252243
order allow,deny

.htaccess.sample

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -238,15 +238,6 @@
238238
Require all denied
239239
</IfVersion>
240240
</Files>
241-
<Files .travis.yml>
242-
<IfVersion < 2.4>
243-
order allow,deny
244-
deny from all
245-
</IfVersion>
246-
<IfVersion >= 2.4>
247-
Require all denied
248-
</IfVersion>
249-
</Files>
250241
<Files CHANGELOG.md>
251242
<IfVersion < 2.4>
252243
order allow,deny

dev/tests/integration/bin/magento

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
* See COPYING.txt for license details.
66
*/
77

8+
use Magento\Framework\Console\Cli;
9+
use Magento\TestFramework\Console\CliProxy;
10+
811
if (PHP_SAPI !== 'cli') {
912
echo 'bin/magento must be run as a CLI application';
1013
exit(1);
@@ -21,15 +24,20 @@ if (isset($_SERVER['INTEGRATION_TEST_PARAMS'])) {
2124
}
2225

2326
try {
24-
require $_SERVER['MAGE_DIRS']['base']['path'] . '/app/bootstrap.php';
27+
require $_SERVER['INTEGRATION_TESTS_CLI_AUTOLOADER'] ??
28+
($_SERVER['MAGE_DIRS']['base']['path'] . '/app/bootstrap.php');
2529
} catch (\Exception $e) {
2630
echo 'Autoload error: ' . $e->getMessage();
2731
exit(1);
2832
}
2933
try {
3034
$handler = new \Magento\Framework\App\ErrorHandler();
3135
set_error_handler([$handler, 'handler']);
32-
$application = new Magento\Framework\Console\Cli('Magento CLI');
36+
if (isset($_SERVER['INTEGRATION_TESTS_CLI_AUTOLOADER'])) {
37+
$application = new CliProxy('Magento CLI');
38+
} else {
39+
$application = new Cli('Magento CLI');
40+
}
3341
$application->run();
3442
} catch (\Exception $e) {
3543
while ($e) {

dev/tests/integration/etc/install-config-mysql.travis.php.dist

Lines changed: 0 additions & 23 deletions
This file was deleted.
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\TestFramework\Console;
9+
10+
use Magento\Framework\Console\Cli;
11+
use Magento\Framework\Exception\LocalizedException;
12+
use Magento\Framework\ObjectManagerInterface;
13+
use Symfony\Component\Console\Input\InputInterface;
14+
use Symfony\Component\Console\Output\OutputInterface;
15+
16+
/**
17+
* Provides the ability to inject additional DI configuration to call a CLI command
18+
*/
19+
class CliProxy implements \Magento\Framework\ObjectManager\NoninterceptableInterface
20+
{
21+
/**
22+
* @var Cli
23+
*/
24+
private $subject;
25+
26+
/**
27+
* @param string $name
28+
* @param string $version
29+
* @throws \ReflectionException
30+
* @throws LocalizedException
31+
*/
32+
public function __construct($name = 'UNKNOWN', $version = 'UNKNOWN')
33+
{
34+
$this->subject = new Cli($name, $version);
35+
$this->injectDiConfiguration($this->subject);
36+
}
37+
38+
/**
39+
* Runs the current application.
40+
*
41+
* @see \Magento\Framework\Console\Cli::doRun
42+
* @param InputInterface $input
43+
* @param OutputInterface $output
44+
* @return int|null
45+
* @throws \Exception
46+
*/
47+
public function doRun(InputInterface $input, OutputInterface $output)
48+
{
49+
return $this->getSubject()->doRun($input, $output);
50+
}
51+
52+
/**
53+
* Runs the current application.
54+
*
55+
* @see \Symfony\Component\Console\Application::run
56+
* @param InputInterface|null $input
57+
* @param OutputInterface|null $output
58+
* @return int
59+
* @throws \Exception
60+
*/
61+
public function run(InputInterface $input = null, OutputInterface $output = null)
62+
{
63+
return $this->getSubject()->run($input, $output);
64+
}
65+
66+
/**
67+
* Get subject
68+
*
69+
* @return Cli
70+
*/
71+
private function getSubject(): Cli
72+
{
73+
return $this->subject;
74+
}
75+
76+
/**
77+
* Inject additional DI configuration
78+
*
79+
* @param Cli $cli
80+
* @return bool
81+
* @throws LocalizedException
82+
* @throws \ReflectionException
83+
*/
84+
private function injectDiConfiguration(Cli $cli): bool
85+
{
86+
$diPreferences = $this->getDiPreferences();
87+
if ($diPreferences) {
88+
$object = new \ReflectionObject($cli);
89+
90+
$attribute = $object->getProperty('objectManager');
91+
$attribute->setAccessible(true);
92+
93+
/** @var ObjectManagerInterface $objectManager */
94+
$objectManager = $attribute->getValue($cli);
95+
$objectManager->configure($diPreferences);
96+
97+
$attribute->setAccessible(false);
98+
}
99+
100+
return true;
101+
}
102+
103+
/**
104+
* Get additional DI preferences
105+
*
106+
* @return array|array[]
107+
* @throws LocalizedException
108+
* @SuppressWarnings(PHPMD.Superglobals)
109+
*/
110+
private function getDiPreferences(): array
111+
{
112+
$diPreferences = [];
113+
$diPreferencesPath = $_SERVER['TESTS_BASE_DIR'] . '/etc/di/preferences/cli/';
114+
115+
$preferenceFiles = glob($diPreferencesPath . '*.php');
116+
117+
foreach ($preferenceFiles as $file) {
118+
if (!is_readable($file)) {
119+
throw new LocalizedException(__("'%1' is not readable file.", $file));
120+
}
121+
$diPreferences = array_replace($diPreferences, include $file);
122+
}
123+
124+
return $diPreferences ? ['preferences' => $diPreferences] : $diPreferences;
125+
}
126+
}

dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testFromCreateProject/composer.lock

Lines changed: 0 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testSkeleton/composer.lock

Lines changed: 0 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dev/tests/integration/testsuite/Magento/MemoryUsageTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ protected function setUp(): void
3232
*/
3333
public function testAppReinitializationNoMemoryLeak()
3434
{
35-
$this->markTestSkipped('Test fails at Travis. Skipped until MAGETWO-47111');
35+
$this->markTestSkipped('Skipped until MAGETWO-47111');
3636

3737
$this->_deallocateUnusedMemory();
3838
$actualMemoryUsage = $this->_helper->getRealMemoryUsage();

dev/tests/integration/testsuite/Magento/Phpserver/PhpserverTest.php

Lines changed: 32 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
*/
66
namespace Magento\Phpserver;
77

8+
use Symfony\Component\Process\PhpExecutableFinder;
9+
use Symfony\Component\Process\Process;
10+
811
/**
912
* @magentoAppIsolation enabled
1013
*
@@ -19,47 +22,54 @@ class PhpserverTest extends \PHPUnit\Framework\TestCase
1922
{
2023
const BASE_URL = '127.0.0.1:8082';
2124

22-
private static $serverPid;
25+
/**
26+
* @var Process
27+
*/
28+
private $serverProcess;
2329

2430
/**
2531
* @var \Laminas\Http\Client
2632
*/
2733
private $httpClient;
2834

35+
private function getUrl($url)
36+
{
37+
return sprintf('http://%s/%s', self::BASE_URL, ltrim($url, '/'));
38+
}
39+
2940
/**
30-
* Instantiate phpserver in the pub folder
41+
* @SuppressWarnings(PHPMD.UnusedLocalVariable)
3142
*/
32-
public static function setUpBeforeClass(): void
43+
protected function setUp(): void
3344
{
34-
if (!(defined('TRAVIS') && TRAVIS === true)) {
35-
self::markTestSkipped('Travis environment test');
36-
}
37-
$return = [];
45+
$this->httpClient = new \Laminas\Http\Client(null, ['timeout' => 10]);
3846

39-
$baseDir = __DIR__ . '/../../../../../../';
47+
/** @var Process $process */
48+
$phpBinaryFinder = new PhpExecutableFinder();
49+
$phpBinaryPath = $phpBinaryFinder->find();
4050
$command = sprintf(
41-
'cd %s && php -S %s -t ./pub/ ./phpserver/router.php >/dev/null 2>&1 & echo $!',
42-
$baseDir,
43-
static::BASE_URL
51+
"%s -S %s -t ./pub ./phpserver/router.php",
52+
$phpBinaryPath,
53+
self::BASE_URL
4454
);
45-
// phpcs:ignore
46-
exec($command, $return);
47-
static::$serverPid = (int) $return[0];
48-
}
49-
50-
private function getUrl($url)
51-
{
52-
return sprintf('http://%s/%s', self::BASE_URL, ltrim($url, '/'));
55+
$this->serverProcess = Process::fromShellCommandline(
56+
$command,
57+
realpath(__DIR__ . '/../../../../../../')
58+
);
59+
$this->serverProcess->start();
60+
$this->serverProcess->waitUntil(function ($type, $output) {
61+
return strpos($output, "Development Server") !== false;
62+
});
5363
}
5464

55-
protected function setUp(): void
65+
protected function tearDown(): void
5666
{
57-
$this->httpClient = new \Laminas\Http\Client(null, ['timeout' => 10]);
67+
$this->serverProcess->stop();
5868
}
5969

6070
public function testServerHasPid()
6171
{
62-
$this->assertTrue(static::$serverPid > 0);
72+
$this->assertTrue($this->serverProcess->getPid() > 0);
6373
}
6474

6575
public function testServerResponds()
@@ -86,9 +96,4 @@ public function testStaticImageFile()
8696
$this->assertFalse($response->isClientError());
8797
$this->assertStringStartsWith('image/gif', $response->getHeaders()->get('Content-Type')->getMediaType());
8898
}
89-
90-
public static function tearDownAfterClass(): void
91-
{
92-
posix_kill(static::$serverPid, SIGKILL);
93-
}
9499
}

dev/tests/integration/testsuite/Magento/Setup/Model/_files/testSkeleton/composer.lock

Lines changed: 0 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
return [
8+
'\Magento\Framework\Mview\TriggerCleaner' => '\Magento\TestFramework\Mview\DummyTriggerCleaner',
9+
];

0 commit comments

Comments
 (0)