diff --git a/.gitattributes b/.gitattributes
index b68733eb..1d982360 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -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
diff --git a/.gitignore b/.gitignore
index 8b7ef350..a932082c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,4 @@
/vendor
composer.lock
+phpunit.xml
+.phpunit.result.cache
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 00000000..f4a8bb4e
--- /dev/null
+++ b/.travis.yml
@@ -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
diff --git a/laravel b/bin/laravel
similarity index 100%
rename from laravel
rename to bin/laravel
diff --git a/composer.json b/composer.json
index 433f4671..7b4a8151 100644
--- a/composer.json
+++ b/composer.json
@@ -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
}
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
new file mode 100644
index 00000000..31e2ad96
--- /dev/null
+++ b/phpunit.xml.dist
@@ -0,0 +1,26 @@
+
+
+
+
+ ./tests
+ ./tests/scaffolds
+
+
+
+
+ ./src
+
+
+
diff --git a/src/NewCommand.php b/src/NewCommand.php
index 4551dfde..c3021a65 100644
--- a/src/NewCommand.php
+++ b/src/NewCommand.php
@@ -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)
{
@@ -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);
@@ -94,6 +94,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
if ($process->isSuccessful()) {
$output->writeln('Application ready! Build something amazing.');
}
+
+ return 0;
}
/**
diff --git a/tests-output/.gitignore b/tests-output/.gitignore
new file mode 100644
index 00000000..d6b7ef32
--- /dev/null
+++ b/tests-output/.gitignore
@@ -0,0 +1,2 @@
+*
+!.gitignore
diff --git a/tests/NewCommandTest.php b/tests/NewCommandTest.php
new file mode 100644
index 00000000..a1404b7f
--- /dev/null
+++ b/tests/NewCommandTest.php
@@ -0,0 +1,34 @@
+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');
+ }
+}