Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHPUnit 10 Shift #170

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ vendor
build
composer.phar
composer.lock
.phpunit.result.cache
/.phpunit.cache
report
.DS_Store
*.sublime-project
Expand Down
32 changes: 16 additions & 16 deletions tests/IntegratedTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@

use Illuminate\Support\Facades\Artisan;

class IntegratedTest extends TestCase
final class IntegratedTest extends TestCase
{
public function test_new_package_is_created()
public function test_new_package_is_created(): void
{
Artisan::call('packager:new', ['vendor' => 'MyVendor', 'name' => 'MyPackage']);

$this->seeInConsoleOutput('Package created successfully!');
$this->assertTrue(is_dir(base_path('packages/MyVendor/MyPackage')));
}

public function test_new_package_symlink_is_created()
public function test_new_package_symlink_is_created(): void
{
Artisan::call('packager:new', ['vendor' => 'MyVendor', 'name' => 'MyPackage']);

Expand All @@ -28,7 +28,7 @@ public function test_new_package_symlink_is_created()
$this->assertTrue(is_link(base_path('vendor/myvendor/mypackage')));
}

public function test_new_package_is_installed()
public function test_new_package_is_installed(): void
{
Artisan::call('packager:new', ['vendor' => 'MyVendor', 'name' => 'MyPackage']);

Expand All @@ -37,7 +37,7 @@ public function test_new_package_is_installed()
$this->assertStringContainsString('MyVendor/MyPackage', $composer);
}

public function test_new_package_studly_install()
public function test_new_package_studly_install(): void
{
Artisan::call('packager:new', ['vendor' => 'my-vendor', 'name' => 'my-package']);

Expand All @@ -46,14 +46,14 @@ public function test_new_package_studly_install()
$this->assertTrue(is_file(base_path('packages/my-vendor/my-package/src/MyPackageServiceProvider.php')));
}

public function test_new_package_name_should_be_valid()
public function test_new_package_name_should_be_valid(): void
{
Artisan::call('packager:new', ['vendor' => 'my-vendor', 'name' => '1234-Invalid']);
$this->seeInConsoleOutput('Package was not created. Please choose a valid name.');
$this->assertFalse(is_file(base_path('packages/my-vendor/4-Invalid/src/1234InvalidServiceProvider.php')));
}

public function test_new_package_name_in_interactive_mode_should_be_valid()
public function test_new_package_name_in_interactive_mode_should_be_valid(): void
{
$this->artisan('packager:new', ['--i' => true])
->expectsQuestion('What will be the vendor name?', 'my-vendor')
Expand All @@ -64,14 +64,14 @@ public function test_new_package_name_in_interactive_mode_should_be_valid()
$this->assertFalse(is_file(base_path('packages/my-vendor/4-Invalid/src/1234InvalidServiceProvider.php')));
}

public function test_new_package_vendor_name_should_be_valid()
public function test_new_package_vendor_name_should_be_valid(): void
{
Artisan::call('packager:new', ['vendor' => '1234-invalid', 'name' => 'my-package']);
$this->seeInConsoleOutput('Package was not created. Please choose a valid name.');
$this->assertFalse(is_file(base_path('packages/1234-invalid/my-package/src/MyPackageServiceProvider.php')));
}

public function test_new_package_vendor_name_in_interactive_mode_should_be_valid()
public function test_new_package_vendor_name_in_interactive_mode_should_be_valid(): void
{
$this->artisan('packager:new', ['--i' => true])
->expectsQuestion('What will be the vendor name?', '1234-invalid')
Expand All @@ -82,7 +82,7 @@ public function test_new_package_vendor_name_in_interactive_mode_should_be_valid
$this->assertFalse(is_file(base_path('packages/my-vendor/4-Invalid/src/1234InvalidServiceProvider.php')));
}

public function test_new_package_is_installed_from_custom_skeleton()
public function test_new_package_is_installed_from_custom_skeleton(): void
{
Artisan::call('packager:new', [
'vendor' => 'AnotherVendor',
Expand All @@ -95,15 +95,15 @@ public function test_new_package_is_installed_from_custom_skeleton()
$this->assertStringContainsString('AnotherVendor/AnotherPackage', $composer);
}

public function test_get_package()
public function test_get_package(): void
{
Artisan::call('packager:get',
['url' => 'https://github.com/Jeroen-G/packager-skeleton', 'vendor' => 'MyVendor', 'name' => 'MyPackage']);

$this->seeInConsoleOutput('Package downloaded successfully!');
}

public function test_get_existing_package_with_git()
public function test_get_existing_package_with_git(): void
{
Artisan::call('packager:git',
['url' => 'https://github.com/Seldaek/monolog', 'vendor' => 'monolog', 'name' => 'monolog']);
Expand All @@ -112,7 +112,7 @@ public function test_get_existing_package_with_git()
$this->assertTrue(is_link(base_path('vendor/monolog/monolog')));
}

public function test_get_existing_package_with_get()
public function test_get_existing_package_with_get(): void
{
Artisan::call('packager:get',
['url' => 'https://github.com/Seldaek/monolog', 'vendor' => 'monolog', 'name' => 'monolog', '--branch' => 'main']);
Expand All @@ -121,15 +121,15 @@ public function test_get_existing_package_with_get()
$this->assertTrue(is_link(base_path('vendor/monolog/monolog')));
}

public function test_list_packages()
public function test_list_packages(): void
{
Artisan::call('packager:new', ['vendor' => 'MyVendor', 'name' => 'MyPackage']);
Artisan::call('packager:list');

$this->seeInConsoleOutput('MyVendor');
}

public function test_removing_package()
public function test_removing_package(): void
{
Artisan::call('packager:new', ['vendor' => 'MyVendor', 'name' => 'MyPackage']);
$this->seeInConsoleOutput('MyVendor');
Expand All @@ -138,7 +138,7 @@ public function test_removing_package()
$this->seeInConsoleOutput('Package removed successfully!');
}

public function test_new_package_is_uninstalled()
public function test_new_package_is_uninstalled(): void
{
Artisan::call('packager:new', ['vendor' => 'MyVendor', 'name' => 'MyPackage']);
Artisan::call('packager:remove', ['vendor' => 'MyVendor', 'name' => 'MyPackage', '--no-interaction' => true]);
Expand Down
4 changes: 2 additions & 2 deletions tests/SkeletonArchiveExtractorsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
use Illuminate\Config\Repository;
use Illuminate\Support\Facades\Artisan;

class SkeletonArchiveExtractorsTest extends TestCase
final class SkeletonArchiveExtractorsTest extends TestCase
{
public function test_new_package_is_created_with_tar_gz_skeleton()
public function test_new_package_is_created_with_tar_gz_skeleton(): void
{
Artisan::call('packager:new', ['vendor' => 'MyVendor', 'name' => 'MyPackage']);

Expand Down
4 changes: 2 additions & 2 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ protected function getBasePath()
/**
* Setup before each test.
*/
public function setUp(): void
protected function setUp(): void
{
$this->installTestApp();
parent::setUp();
Expand All @@ -36,7 +36,7 @@ public function setUp(): void
/**
* Tear down after each test.
*/
public function tearDown(): void
protected function tearDown(): void
{
$this->uninstallTestApp();
parent::tearDown();
Expand Down