X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Flibs%2FObjectFactoryTest.php;h=35a7b6028d6f9fc79c97623fe097f89804de037a;hb=be42e09aa866d7def54ead06c91d5dc9c8210ce5;hp=f8dda6f8af6503eb619ca5c858e6f625e10208c1;hpb=fe79bc528b0e054aa630bd4fcfcdd4a9804892da;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/libs/ObjectFactoryTest.php b/tests/phpunit/includes/libs/ObjectFactoryTest.php index f8dda6f8af..35a7b6028d 100644 --- a/tests/phpunit/includes/libs/ObjectFactoryTest.php +++ b/tests/phpunit/includes/libs/ObjectFactoryTest.php @@ -26,20 +26,24 @@ class ObjectFactoryTest extends PHPUnit_Framework_TestCase { public function testClosureExpansionDisabled() { $obj = ObjectFactory::getObjectFromSpec( [ 'class' => 'ObjectFactoryTestFixture', - 'args' => [ function() { - return 'unwrapped'; - }, ], + 'args' => [ + function () { + return 'wrapped'; + }, + 'unwrapped', + ], 'calls' => [ - 'setter' => [ function() { - return 'unwrapped'; + 'setter' => [ function () { + return 'wrapped'; }, ], ], 'closure_expansion' => false, ] ); $this->assertInstanceOf( 'Closure', $obj->args[0] ); - $this->assertSame( 'unwrapped', $obj->args[0]() ); + $this->assertSame( 'wrapped', $obj->args[0]() ); + $this->assertSame( 'unwrapped', $obj->args[1] ); $this->assertInstanceOf( 'Closure', $obj->setterArgs[0] ); - $this->assertSame( 'unwrapped', $obj->setterArgs[0]() ); + $this->assertSame( 'wrapped', $obj->setterArgs[0]() ); } /** @@ -49,28 +53,32 @@ class ObjectFactoryTest extends PHPUnit_Framework_TestCase { public function testClosureExpansionEnabled() { $obj = ObjectFactory::getObjectFromSpec( [ 'class' => 'ObjectFactoryTestFixture', - 'args' => [ function() { - return 'unwrapped'; - }, ], + 'args' => [ + function () { + return 'wrapped'; + }, + 'unwrapped', + ], 'calls' => [ - 'setter' => [ function() { - return 'unwrapped'; + 'setter' => [ function () { + return 'wrapped'; }, ], ], 'closure_expansion' => true, ] ); $this->assertInternalType( 'string', $obj->args[0] ); - $this->assertSame( 'unwrapped', $obj->args[0] ); + $this->assertSame( 'wrapped', $obj->args[0] ); + $this->assertSame( 'unwrapped', $obj->args[1] ); $this->assertInternalType( 'string', $obj->setterArgs[0] ); - $this->assertSame( 'unwrapped', $obj->setterArgs[0] ); + $this->assertSame( 'wrapped', $obj->setterArgs[0] ); $obj = ObjectFactory::getObjectFromSpec( [ 'class' => 'ObjectFactoryTestFixture', - 'args' => [ function() { + 'args' => [ function () { return 'unwrapped'; }, ], 'calls' => [ - 'setter' => [ function() { + 'setter' => [ function () { return 'unwrapped'; }, ], ],