Laravel

Upgrade

November 28, 2022
PHP, Rector, Laravel, Upgrade, Refactoring

PHP Upgrade # Supported Versions # https://www.php.net/supported-versions.php https://qiita.com/bezeklik/items/72d1ff8393f66673e2bc Rector # Overview # rectorphp/rector Rector instantly upgrades and refactors the PHP code of your application. Rules Overview Install # $ composer require rector/rector --dev $ composer install $ vendor/bin/rector init $ vi rector.php <?php declare(strict_types=1); // use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector; use Rector\Config\RectorConfig; use Rector\Set\ValueObject\LevelSetList; return static function (RectorConfig $rectorConfig): void { // register paths to upgrade and refactor PHP code $rectorConfig->paths([ __DIR__ . ...

PHPUnit

January 1, 2020
PHPUnit, Laravel, Test

PHPUnit # 事前準備 # インストール # composer.json "require-dev": { "fzaninotto/faker": "*", "mikey179/vfsstream": "*", "mockery/mockery": "*", "phpunit/phpunit": "*" }, $ composer install バージョンの確認 # $ ./vendor/bin/phpunit --version 基本 # <?php use Aaa\ClassA; use Bbb\ClassB; use Eee\ExceptionA; use Mockery; use PHPUnit\Framework\TestCase; /** * @coversDefaultClass Aaa\ClassA */ class ClassATest extends TestCase { // Omitted /** * This method is called before class. TestCaseクラス実行前の処理。 * * @return void */ public static function setUpBeforeClass(): void { parent::setUpBeforeClass(); // static 変数を使用(static メソッドのため) self::$hoge = 'some value'; } /** * This method is called before each test. ...