-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from citrus-framework/fix_php8
php8化対応
- Loading branch information
Showing
3 changed files
with
55 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* @copyright Copyright 2020, CitrusVariables. All Rights Reserved. | ||
* @author take64 <take64@citrus.tk> | ||
* @license http://www.citrus.tk/ | ||
*/ | ||
|
||
namespace Test\Variable; | ||
|
||
use Citrus\Variable\Singleton; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
/** | ||
* シングルトンのテスト | ||
*/ | ||
class SingletonTest extends TestCase | ||
{ | ||
/** | ||
* @test | ||
*/ | ||
public function sharedInstance_想定通り() | ||
{ | ||
// php8以降、メソッド内静的変数が共通領域になってしまった | ||
$this->assertInstanceOf(TestA::class, TestA::sharedInstance()); | ||
$this->assertInstanceOf(TestB::class, TestB::sharedInstance()); | ||
} | ||
} | ||
|
||
class TestP | ||
{ | ||
use Singleton; | ||
} | ||
|
||
class TestA extends TestP | ||
{ | ||
} | ||
|
||
class TestB extends TestP | ||
{ | ||
} |