Skip to content

Commit

Permalink
Merge pull request laravel#104 from laravel/symfony5
Browse files Browse the repository at this point in the history
[3.x] Prepare 3.0 release
  • Loading branch information
taylorotwell authored Nov 25, 2019
2 parents 9f04c94 + f5cd20a commit 3eed191
Show file tree
Hide file tree
Showing 9 changed files with 114 additions and 11 deletions.
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
* text=auto

/.github export-ignore
/tests export-ignore
/tests-output export-ignore
.editorconfig export-ignore
.gitattributes export-ignore
.gitignore export-ignore
.styleci.yml export-ignore
.travis.yml export-ignore
CHANGELOG.md export-ignore
phpunit.xml.dist export-ignore
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
/vendor
composer.lock
phpunit.xml
.phpunit.result.cache
14 changes: 14 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
language: php

php:
- 7.2
- 7.3

sudo: false

before_install:
- phpenv config-rm xdebug.ini || true

install: travis_retry composer install --no-interaction --prefer-dist

script: vendor/bin/phpunit --verbose
File renamed without changes.
37 changes: 28 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,38 @@
"email": "taylorotwell@gmail.com"
}
],
"require": {
"php": "^7.2",
"ext-zip": "*",
"guzzlehttp/guzzle": "^6.0",
"symfony/console": "^4.0|^5.0",
"symfony/filesystem": "^4.0|^5.0",
"symfony/process": "^4.0|^5.0"
},
"require-dev": {
"phpunit/phpunit": "^8.0"
},
"bin": [
"bin/laravel"
],
"autoload": {
"psr-4": {
"Laravel\\Installer\\Console\\": "src/"
}
},
"require": {
"ext-zip": "*",
"guzzlehttp/guzzle": "~6.0",
"symfony/console": "~3.0|~4.0",
"symfony/filesystem": "~3.0|~4.0",
"symfony/process": "~3.0|~4.0"
"autoload-dev": {
"psr-4": {
"Laravel\\Installer\\Console\\Tests\\": "tests/"
}
},
"bin": [
"laravel"
]
"extra": {
"branch-alias": {
"dev-master": "3.x-dev"
}
},
"config": {
"sort-packages": true
},
"minimum-stability": "dev",
"prefer-stable": true
}
26 changes: 26 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
beStrictAboutTestsThatDoNotTestAnything="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnError="false"
stopOnFailure="false"
verbose="true"
>
<testsuites>
<testsuite name="Laravel Installer Test Suite">
<directory suffix="Test.php">./tests</directory>
<exclude>./tests/scaffolds</exclude>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./src</directory>
</whitelist>
</filter>
</phpunit>
6 changes: 4 additions & 2 deletions src/NewCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ protected function configure()
*
* @param \Symfony\Component\Console\Input\InputInterface $input
* @param \Symfony\Component\Console\Output\OutputInterface $output
* @return void
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
Expand Down Expand Up @@ -81,7 +81,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
}, $commands);
}

$process = new Process(implode(' && ', $commands), $directory, null, null, null);
$process = Process::fromShellCommandline(implode(' && ', $commands), $directory, null, null, null);

if ('\\' !== DIRECTORY_SEPARATOR && file_exists('/dev/tty') && is_readable('/dev/tty')) {
$process->setTty(true);
Expand All @@ -94,6 +94,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
if ($process->isSuccessful()) {
$output->writeln('<comment>Application ready! Build something amazing.</comment>');
}

return 0;
}

/**
Expand Down
2 changes: 2 additions & 0 deletions tests-output/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore
34 changes: 34 additions & 0 deletions tests/NewCommandTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

namespace Laravel\Installer\Console\Tests;

use Laravel\Installer\Console\NewCommand;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Tester\CommandTester;
use Symfony\Component\Filesystem\Filesystem;

class NewCommandTest extends TestCase
{
public function test_it_can_scaffold_a_new_laravel_app()
{
$scaffoldDirectoryName = 'tests-output/my-app';
$scaffoldDirectory = __DIR__.'/../'.$scaffoldDirectoryName;

if (file_exists($scaffoldDirectory)) {
(new Filesystem)->remove($scaffoldDirectory);
}

$app = new Application('Laravel Installer');
$app->add(new NewCommand);

$tester = new CommandTester($app->find('new'));

$statusCode = $tester->execute(['name' => $scaffoldDirectoryName, '--auth' => null]);

$this->assertEquals($statusCode, 0);
$this->assertDirectoryExists($scaffoldDirectory.'/vendor');
$this->assertFileExists($scaffoldDirectory.'/.env');
$this->assertFileExists($scaffoldDirectory.'/resources/views/auth/login.blade.php');
}
}

0 comments on commit 3eed191

Please sign in to comment.