-
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.
Migrate to PHPUnit 11 Migrate to usage trait in trait (to simplify usage)
- Loading branch information
1 parent
35c5b66
commit 9574043
Showing
20 changed files
with
224 additions
and
69 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
build: | ||
environment: | ||
php: 8.1 | ||
php: 8.2 | ||
nodes: | ||
analysis: | ||
tests: | ||
|
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
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
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,87 @@ | ||
<?php | ||
|
||
/** | ||
* @copyright Bluz PHP Team | ||
* @link https://github.com/bluzphp/framework | ||
*/ | ||
|
||
namespace Bluz\Tests\Container; | ||
|
||
use Bluz\Tests\Container\Fixtures\ComplexContainer; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
/** | ||
* Tests for ComplexContainer | ||
* | ||
* @package Bluz\Tests\Common | ||
* | ||
* @author Anton Shevchuk | ||
*/ | ||
class ComplexContainerTest extends TestCase | ||
{ | ||
|
||
/** | ||
* @var ComplexContainer | ||
*/ | ||
protected ComplexContainer $class; | ||
|
||
protected array $example = [ | ||
'foo' => 'bar', | ||
'quz' => 'qux' | ||
]; | ||
|
||
/** | ||
* Sets up the fixture, for example, opens a network connection. | ||
* This method is called before a test is executed. | ||
*/ | ||
protected function setUp(): void | ||
{ | ||
$this->class = new ComplexContainer(); | ||
} | ||
|
||
/** | ||
* Test ArrayAccess trait | ||
*/ | ||
public function testArrayAccess() | ||
{ | ||
$this->class['foo'] = 'bar'; | ||
$this->class['quz'] = 'qux'; | ||
|
||
unset($this->class['quz']); | ||
|
||
self::assertEquals('bar', $this->class['foo']); | ||
self::assertFalse(isset($this->class['quz'])); | ||
self::assertFalse(isset($this->class['some'])); | ||
self::assertEmpty($this->class['quz']); | ||
self::assertEmpty($this->class['some']); | ||
self::assertNull($this->class['quz']); | ||
} | ||
|
||
/** | ||
* Test MagicAccess trait | ||
*/ | ||
public function testMagicAccess() | ||
{ | ||
$this->class->foo = 'bar'; | ||
$this->class->quz = 'qux'; | ||
|
||
unset($this->class->quz); | ||
|
||
self::assertEquals('bar', $this->class->foo); | ||
self::assertFalse(isset($this->class->quz)); | ||
self::assertFalse(isset($this->class->some)); | ||
self::assertEmpty($this->class->quz); | ||
self::assertEmpty($this->class->some); | ||
self::assertNull($this->class->quz); | ||
} | ||
|
||
/** | ||
* Test JsonSerialize implementation | ||
*/ | ||
public function testJsonSerialize() | ||
{ | ||
$this->class->setFromArray($this->example); | ||
|
||
self::assertJsonStringEqualsJsonString(json_encode($this->example), json_encode($this->class)); | ||
} | ||
} |
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,26 @@ | ||
<?php | ||
|
||
/** | ||
* @copyright Bluz PHP Team | ||
* @link https://github.com/bluzphp/framework | ||
*/ | ||
|
||
/** | ||
* @namespace | ||
*/ | ||
|
||
namespace Bluz\Tests\Container\Fixtures; | ||
|
||
use Bluz\Container\JsonSerialize; | ||
|
||
/** | ||
* Concrete class with JsonSerialize trait | ||
* | ||
* @package Bluz\Tests\Common | ||
* | ||
* @author Anton Shevchuk | ||
*/ | ||
class JsonContainer implements \JsonSerializable | ||
{ | ||
use JsonSerialize; | ||
} |
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,26 @@ | ||
<?php | ||
|
||
/** | ||
* @copyright Bluz PHP Team | ||
* @link https://github.com/bluzphp/framework | ||
*/ | ||
|
||
/** | ||
* @namespace | ||
*/ | ||
|
||
namespace Bluz\Tests\Container\Fixtures; | ||
|
||
use Bluz\Container\Container; | ||
|
||
/** | ||
* Concrete class with just Container trait | ||
* | ||
* @package Bluz\Tests\Common | ||
* | ||
* @author Anton Shevchuk | ||
*/ | ||
class SimpleContainer | ||
{ | ||
use Container; | ||
} |
Oops, something went wrong.