Skip to content

Commit

Permalink
Merge pull request #5953 from magento-trigger/MC-34427
Browse files Browse the repository at this point in the history
[Trigger]  Remove google-shopping-ads module and cleanup travis configuration
  • Loading branch information
xmav authored Aug 5, 2020
2 parents b4770e4 + 3521b44 commit d76acc2
Show file tree
Hide file tree
Showing 22 changed files with 537 additions and 153 deletions.
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ For more detailed information on contribution please read our [beginners guide](
* Unit/integration test coverage
* Proposed [documentation](https://devdocs.magento.com) updates. Documentation contributions can be submitted via the [devdocs GitHub](https://github.com/magento/devdocs).
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.
5. All automated tests must pass (all builds on [Travis CI](https://travis-ci.org/magento/magento2) must be green).
5. All automated tests must pass.

## Contribution process

Expand Down
9 changes: 0 additions & 9 deletions .htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -238,15 +238,6 @@
Require all denied
</IfVersion>
</Files>
<Files .travis.yml>
<IfVersion < 2.4>
order allow,deny
deny from all
</IfVersion>
<IfVersion >= 2.4>
Require all denied
</IfVersion>
</Files>
<Files CHANGELOG.md>
<IfVersion < 2.4>
order allow,deny
Expand Down
9 changes: 0 additions & 9 deletions .htaccess.sample
Original file line number Diff line number Diff line change
Expand Up @@ -238,15 +238,6 @@
Require all denied
</IfVersion>
</Files>
<Files .travis.yml>
<IfVersion < 2.4>
order allow,deny
deny from all
</IfVersion>
<IfVersion >= 2.4>
Require all denied
</IfVersion>
</Files>
<Files CHANGELOG.md>
<IfVersion < 2.4>
order allow,deny
Expand Down
12 changes: 10 additions & 2 deletions dev/tests/integration/bin/magento
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
* See COPYING.txt for license details.
*/

use Magento\Framework\Console\Cli;
use Magento\TestFramework\Console\CliProxy;

if (PHP_SAPI !== 'cli') {
echo 'bin/magento must be run as a CLI application';
exit(1);
Expand All @@ -21,15 +24,20 @@ if (isset($_SERVER['INTEGRATION_TEST_PARAMS'])) {
}

try {
require $_SERVER['MAGE_DIRS']['base']['path'] . '/app/bootstrap.php';
require $_SERVER['INTEGRATION_TESTS_CLI_AUTOLOADER'] ??
($_SERVER['MAGE_DIRS']['base']['path'] . '/app/bootstrap.php');
} catch (\Exception $e) {
echo 'Autoload error: ' . $e->getMessage();
exit(1);
}
try {
$handler = new \Magento\Framework\App\ErrorHandler();
set_error_handler([$handler, 'handler']);
$application = new Magento\Framework\Console\Cli('Magento CLI');
if (isset($_SERVER['INTEGRATION_TESTS_CLI_AUTOLOADER'])) {
$application = new CliProxy('Magento CLI');
} else {
$application = new Cli('Magento CLI');
}
$application->run();
} catch (\Exception $e) {
while ($e) {
Expand Down
23 changes: 0 additions & 23 deletions dev/tests/integration/etc/install-config-mysql.travis.php.dist

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\TestFramework\Console;

use Magento\Framework\Console\Cli;
use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\ObjectManagerInterface;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

/**
* Provides the ability to inject additional DI configuration to call a CLI command
*/
class CliProxy implements \Magento\Framework\ObjectManager\NoninterceptableInterface
{
/**
* @var Cli
*/
private $subject;

/**
* @param string $name
* @param string $version
* @throws \ReflectionException
* @throws LocalizedException
*/
public function __construct($name = 'UNKNOWN', $version = 'UNKNOWN')
{
$this->subject = new Cli($name, $version);
$this->injectDiConfiguration($this->subject);
}

/**
* Runs the current application.
*
* @see \Magento\Framework\Console\Cli::doRun
* @param InputInterface $input
* @param OutputInterface $output
* @return int|null
* @throws \Exception
*/
public function doRun(InputInterface $input, OutputInterface $output)
{
return $this->getSubject()->doRun($input, $output);
}

/**
* Runs the current application.
*
* @see \Symfony\Component\Console\Application::run
* @param InputInterface|null $input
* @param OutputInterface|null $output
* @return int
* @throws \Exception
*/
public function run(InputInterface $input = null, OutputInterface $output = null)
{
return $this->getSubject()->run($input, $output);
}

/**
* Get subject
*
* @return Cli
*/
private function getSubject(): Cli
{
return $this->subject;
}

/**
* Inject additional DI configuration
*
* @param Cli $cli
* @return bool
* @throws LocalizedException
* @throws \ReflectionException
*/
private function injectDiConfiguration(Cli $cli): bool
{
$diPreferences = $this->getDiPreferences();
if ($diPreferences) {
$object = new \ReflectionObject($cli);

$attribute = $object->getProperty('objectManager');
$attribute->setAccessible(true);

/** @var ObjectManagerInterface $objectManager */
$objectManager = $attribute->getValue($cli);
$objectManager->configure($diPreferences);

$attribute->setAccessible(false);
}

return true;
}

/**
* Get additional DI preferences
*
* @return array|array[]
* @throws LocalizedException
* @SuppressWarnings(PHPMD.Superglobals)
*/
private function getDiPreferences(): array
{
$diPreferences = [];
$diPreferencesPath = $_SERVER['TESTS_BASE_DIR'] . '/etc/di/preferences/cli/';

$preferenceFiles = glob($diPreferencesPath . '*.php');

foreach ($preferenceFiles as $file) {
if (!is_readable($file)) {
throw new LocalizedException(__("'%1' is not readable file.", $file));
}
$diPreferences = array_replace($diPreferences, include $file);
}

return $diPreferences ? ['preferences' => $diPreferences] : $diPreferences;
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ protected function setUp(): void
*/
public function testAppReinitializationNoMemoryLeak()
{
$this->markTestSkipped('Test fails at Travis. Skipped until MAGETWO-47111');
$this->markTestSkipped('Skipped until MAGETWO-47111');

$this->_deallocateUnusedMemory();
$actualMemoryUsage = $this->_helper->getRealMemoryUsage();
Expand Down
59 changes: 32 additions & 27 deletions dev/tests/integration/testsuite/Magento/Phpserver/PhpserverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
*/
namespace Magento\Phpserver;

use Symfony\Component\Process\PhpExecutableFinder;
use Symfony\Component\Process\Process;

/**
* @magentoAppIsolation enabled
*
Expand All @@ -19,47 +22,54 @@ class PhpserverTest extends \PHPUnit\Framework\TestCase
{
const BASE_URL = '127.0.0.1:8082';

private static $serverPid;
/**
* @var Process
*/
private $serverProcess;

/**
* @var \Laminas\Http\Client
*/
private $httpClient;

private function getUrl($url)
{
return sprintf('http://%s/%s', self::BASE_URL, ltrim($url, '/'));
}

/**
* Instantiate phpserver in the pub folder
* @SuppressWarnings(PHPMD.UnusedLocalVariable)
*/
public static function setUpBeforeClass(): void
protected function setUp(): void
{
if (!(defined('TRAVIS') && TRAVIS === true)) {
self::markTestSkipped('Travis environment test');
}
$return = [];
$this->httpClient = new \Laminas\Http\Client(null, ['timeout' => 10]);

$baseDir = __DIR__ . '/../../../../../../';
/** @var Process $process */
$phpBinaryFinder = new PhpExecutableFinder();
$phpBinaryPath = $phpBinaryFinder->find();
$command = sprintf(
'cd %s && php -S %s -t ./pub/ ./phpserver/router.php >/dev/null 2>&1 & echo $!',
$baseDir,
static::BASE_URL
"%s -S %s -t ./pub ./phpserver/router.php",
$phpBinaryPath,
self::BASE_URL
);
// phpcs:ignore
exec($command, $return);
static::$serverPid = (int) $return[0];
}

private function getUrl($url)
{
return sprintf('http://%s/%s', self::BASE_URL, ltrim($url, '/'));
$this->serverProcess = Process::fromShellCommandline(
$command,
realpath(__DIR__ . '/../../../../../../')
);
$this->serverProcess->start();
$this->serverProcess->waitUntil(function ($type, $output) {
return strpos($output, "Development Server") !== false;
});
}

protected function setUp(): void
protected function tearDown(): void
{
$this->httpClient = new \Laminas\Http\Client(null, ['timeout' => 10]);
$this->serverProcess->stop();
}

public function testServerHasPid()
{
$this->assertTrue(static::$serverPid > 0);
$this->assertTrue($this->serverProcess->getPid() > 0);
}

public function testServerResponds()
Expand All @@ -86,9 +96,4 @@ public function testStaticImageFile()
$this->assertFalse($response->isClientError());
$this->assertStringStartsWith('image/gif', $response->getHeaders()->get('Content-Type')->getMediaType());
}

public static function tearDownAfterClass(): void
{
posix_kill(static::$serverPid, SIGKILL);
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions dev/tests/setup-integration/etc/di/preferences/cli/ce.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

return [
'\Magento\Framework\Mview\TriggerCleaner' => '\Magento\TestFramework\Mview\DummyTriggerCleaner',
];
Loading

0 comments on commit d76acc2

Please sign in to comment.