[ SYSTEM ]: Linux wordpress 6.1.0-44-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.164-1 (2026-03-09) x86_64
[ SERVER ]: Apache/2.4.66 (Debian) | PHP: 8.2.30
[ USER ]: www-data | IP: 172.19.30.54
GEFORCE FILE MANAGER
/
var
/
www
/
html
/
wordpress
/
wp-content
/
plugins
/
presto-player
/
vendor
/
level-2
/
dice
/
tests
/
UPLOAD:
NAME
SIZE
QUICK PERMS
ACTIONS
📁 TestData
SET
[ DEL ]
📄 BasicTest.php
5,916 B
SET
[ EDIT ]
|
[ DEL ]
📄 CallTest.php
2,584 B
SET
[ EDIT ]
|
[ DEL ]
📄 ChainTest.php
2,558 B
SET
[ EDIT ]
|
[ DEL ]
📄 ConstructParamsTest.php
3,932 B
SET
[ EDIT ]
|
[ DEL ]
📄 CreateArgsTest.php
2,858 B
SET
[ EDIT ]
|
[ DEL ]
📄 DiceTest.php
1,224 B
SET
[ EDIT ]
|
[ DEL ]
📄 NamedInstancesTest.php
3,624 B
SET
[ EDIT ]
|
[ DEL ]
📄 NamespaceTest.php
2,039 B
SET
[ EDIT ]
|
[ DEL ]
📄 ShareInstancesTest.php
3,755 B
SET
[ EDIT ]
|
[ DEL ]
📄 SubstitutionsTest.php
2,966 B
SET
[ EDIT ]
|
[ DEL ]
📄 bootstrap.php
344 B
SET
[ EDIT ]
|
[ DEL ]
DELETE SELECTED
[ CLOSE ]
EDIT: SubstitutionsTest.php
<?php /* @description Dice - A minimal Dependency Injection Container for PHP * * @author Tom Butler tom@r.je * * @copyright 2012-2018 Tom Butler <tom@r.je> | https:// r.je/dice.html * * @license http:// www.opensource.org/licenses/bsd-license.php BSD License * * @version 3.0 */ class SubstitutionsTest extends DiceTest { public function testNoMoreAssign() { $rule = []; $rule['substitutions']['Bar77'] = [\Dice\Dice::INSTANCE => function() { return Baz77::create(); }]; $dice = $this->dice->addRule('Foo77', $rule); $foo = $dice->create('Foo77'); $this->assertInstanceOf('Bar77', $foo->bar); $this->assertEquals('Z', $foo->bar->a); } public function testNullSubstitution() { $rule = []; $rule['substitutions']['B'] = null; $dice = $this->dice->addRule('MethodWithDefaultNull', $rule); $obj = $dice->create('MethodWithDefaultNull'); $this->assertNull($obj->b); } public function testSubstitutionText() { $rule = []; $rule['substitutions']['B'] = [\Dice\Dice::INSTANCE => 'ExtendedB']; $dice = $this->dice->addRule('A', $rule); $a = $dice->create('A'); $this->assertInstanceOf('ExtendedB', $a->b); } public function testSubstitutionTextMixedCase() { $rule = []; $rule['substitutions']['B'] = [\Dice\Dice::INSTANCE => 'exTenDedb']; $dice = $this->dice->addRule('A', $rule); $a = $dice->create('A'); $this->assertInstanceOf('ExtendedB', $a->b); } public function testSubstitutionCallback() { $rule = []; $injection = $this->dice; $rule['substitutions']['B'] = [\Dice\Dice::INSTANCE => function() use ($injection) { return $injection->create('ExtendedB'); }]; $dice = $this->dice->addRule('A', $rule); $a = $dice->create('A'); $this->assertInstanceOf('ExtendedB', $a->b); } public function testSubstitutionObject() { $rule = []; $rule['substitutions']['B'] = $this->dice->create('ExtendedB'); $dice = $this->dice->addRule('A', $rule); $a = $dice->create('A'); $this->assertInstanceOf('ExtendedB', $a->b); } public function testSubstitutionString() { $rule = []; $rule['substitutions']['B'] = [\Dice\Dice::INSTANCE => 'ExtendedB']; $dice = $this->dice->addRule('A', $rule); $a = $dice->create('A'); $this->assertInstanceOf('ExtendedB', $a->b); } public function testSubFromString() { $rule = [ 'substitutions' => ['Bar' => 'Baz'] ]; $dice = $this->dice->addRule('*', $rule); $obj = $dice->create('Foo'); $this->assertInstanceOf('Baz', $obj->bar); } public function testSubstitutionWithFuncCall() { $rule = []; $rule['substitutions']['Bar'] = [\Dice\Dice::INSTANCE => ['Foo2', 'bar']]; $dice = $this->dice->addRule('Foo', $rule); $a = $dice->create('Foo'); $this->assertInstanceOf('Baz', $a->bar); } } class Foo { public $bar; public function __construct(Bar $bar) { $this->bar = $bar; } } class Foo2 { public function bar() { return new Baz; } } interface Bar { } class Baz implements Bar { }