Skip to content

Commit 3eed191

Browse files
authored
Merge pull request #104 from laravel/symfony5
[3.x] Prepare 3.0 release
2 parents 9f04c94 + f5cd20a commit 3eed191

File tree

9 files changed

+114
-11
lines changed

9 files changed

+114
-11
lines changed

.gitattributes

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
* text=auto
22

33
/.github export-ignore
4+
/tests export-ignore
5+
/tests-output export-ignore
46
.editorconfig export-ignore
57
.gitattributes export-ignore
68
.gitignore export-ignore
79
.styleci.yml export-ignore
10+
.travis.yml export-ignore
811
CHANGELOG.md export-ignore
12+
phpunit.xml.dist export-ignore

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
/vendor
22
composer.lock
3+
phpunit.xml
4+
.phpunit.result.cache

.travis.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
language: php
2+
3+
php:
4+
- 7.2
5+
- 7.3
6+
7+
sudo: false
8+
9+
before_install:
10+
- phpenv config-rm xdebug.ini || true
11+
12+
install: travis_retry composer install --no-interaction --prefer-dist
13+
14+
script: vendor/bin/phpunit --verbose
File renamed without changes.

composer.json

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,38 @@
99
"email": "[email protected]"
1010
}
1111
],
12+
"require": {
13+
"php": "^7.2",
14+
"ext-zip": "*",
15+
"guzzlehttp/guzzle": "^6.0",
16+
"symfony/console": "^4.0|^5.0",
17+
"symfony/filesystem": "^4.0|^5.0",
18+
"symfony/process": "^4.0|^5.0"
19+
},
20+
"require-dev": {
21+
"phpunit/phpunit": "^8.0"
22+
},
23+
"bin": [
24+
"bin/laravel"
25+
],
1226
"autoload": {
1327
"psr-4": {
1428
"Laravel\\Installer\\Console\\": "src/"
1529
}
1630
},
17-
"require": {
18-
"ext-zip": "*",
19-
"guzzlehttp/guzzle": "~6.0",
20-
"symfony/console": "~3.0|~4.0",
21-
"symfony/filesystem": "~3.0|~4.0",
22-
"symfony/process": "~3.0|~4.0"
31+
"autoload-dev": {
32+
"psr-4": {
33+
"Laravel\\Installer\\Console\\Tests\\": "tests/"
34+
}
2335
},
24-
"bin": [
25-
"laravel"
26-
]
36+
"extra": {
37+
"branch-alias": {
38+
"dev-master": "3.x-dev"
39+
}
40+
},
41+
"config": {
42+
"sort-packages": true
43+
},
44+
"minimum-stability": "dev",
45+
"prefer-stable": true
2746
}

phpunit.xml.dist

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit backupGlobals="false"
3+
backupStaticAttributes="false"
4+
beStrictAboutTestsThatDoNotTestAnything="false"
5+
bootstrap="vendor/autoload.php"
6+
colors="true"
7+
convertErrorsToExceptions="true"
8+
convertNoticesToExceptions="true"
9+
convertWarningsToExceptions="true"
10+
processIsolation="false"
11+
stopOnError="false"
12+
stopOnFailure="false"
13+
verbose="true"
14+
>
15+
<testsuites>
16+
<testsuite name="Laravel Installer Test Suite">
17+
<directory suffix="Test.php">./tests</directory>
18+
<exclude>./tests/scaffolds</exclude>
19+
</testsuite>
20+
</testsuites>
21+
<filter>
22+
<whitelist processUncoveredFilesFromWhitelist="true">
23+
<directory suffix=".php">./src</directory>
24+
</whitelist>
25+
</filter>
26+
</phpunit>

src/NewCommand.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ protected function configure()
3737
*
3838
* @param \Symfony\Component\Console\Input\InputInterface $input
3939
* @param \Symfony\Component\Console\Output\OutputInterface $output
40-
* @return void
40+
* @return int
4141
*/
4242
protected function execute(InputInterface $input, OutputInterface $output)
4343
{
@@ -81,7 +81,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
8181
}, $commands);
8282
}
8383

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

8686
if ('\\' !== DIRECTORY_SEPARATOR && file_exists('/dev/tty') && is_readable('/dev/tty')) {
8787
$process->setTty(true);
@@ -94,6 +94,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
9494
if ($process->isSuccessful()) {
9595
$output->writeln('<comment>Application ready! Build something amazing.</comment>');
9696
}
97+
98+
return 0;
9799
}
98100

99101
/**

tests-output/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*
2+
!.gitignore

tests/NewCommandTest.php

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
namespace Laravel\Installer\Console\Tests;
4+
5+
use Laravel\Installer\Console\NewCommand;
6+
use PHPUnit\Framework\TestCase;
7+
use Symfony\Component\Console\Application;
8+
use Symfony\Component\Console\Tester\CommandTester;
9+
use Symfony\Component\Filesystem\Filesystem;
10+
11+
class NewCommandTest extends TestCase
12+
{
13+
public function test_it_can_scaffold_a_new_laravel_app()
14+
{
15+
$scaffoldDirectoryName = 'tests-output/my-app';
16+
$scaffoldDirectory = __DIR__.'/../'.$scaffoldDirectoryName;
17+
18+
if (file_exists($scaffoldDirectory)) {
19+
(new Filesystem)->remove($scaffoldDirectory);
20+
}
21+
22+
$app = new Application('Laravel Installer');
23+
$app->add(new NewCommand);
24+
25+
$tester = new CommandTester($app->find('new'));
26+
27+
$statusCode = $tester->execute(['name' => $scaffoldDirectoryName, '--auth' => null]);
28+
29+
$this->assertEquals($statusCode, 0);
30+
$this->assertDirectoryExists($scaffoldDirectory.'/vendor');
31+
$this->assertFileExists($scaffoldDirectory.'/.env');
32+
$this->assertFileExists($scaffoldDirectory.'/resources/views/auth/login.blade.php');
33+
}
34+
}

0 commit comments

Comments
 (0)