server/apps/files_sharing/tests
Daniel Calviño Sánchez b70b38ce31 Fix constructor spy in unit test with Sinon 4.1.3
When a constructor is spied using Sinon it is wrapped by a proxy
function, which calls the original constructor when invoked. When "new
Foo()" is executed a "Foo" object is created, "Foo" is invoked with the
object as "this", and the object is returned as the result of the whole
"new" expression.

Before Sinon 4.1.3 the proxy called the original constructor directly
using the "thisValue" of the spied call; "thisValue" was the object
created by the "new" operator that called the proxy. The proxy assigned
"thisValue" to "returnValue", so it was also the value returned by the
proxy and, in turn, the value returned by the whole "new" expression.

Since Sinon 4.1.3 (see pull request 1626) the proxy calls the original
constructor using "new" instead of directly. The "thisValue" created by
the outermost "new" (the one that called the proxy) is no longer used by
the original constructor; the internal "new" creates a new object, which
is the one passed to the original constructor and returned by the
internal "new" expression. This object is also the value returned by the
proxy ("returnValue") and, in turn, the value returned by the whole
outermost "new" expression.

Thus, now "returnValue" should be used instead of "thisValue" to get the
object created by the spied constructor.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2017-12-08 21:26:45 +01:00
..
Collaboration fix sharerecipientssorter tests 2017-10-27 16:03:37 +02:00
Command Update license headers 2017-11-06 16:56:19 +01:00
Controller Change @georgehrke's email 2017-11-06 20:38:59 +01:00
External Update license headers 2017-11-06 16:56:19 +01:00
js Fix constructor spy in unit test with Sinon 4.1.3 2017-12-08 21:26:45 +01:00
Middleware Change @georgehrke's email 2017-11-06 20:38:59 +01:00
Migration Update license headers 2017-11-06 16:56:19 +01:00
ApiTest.php Update license headers 2017-11-06 16:56:19 +01:00
BackendTest.php Update license headers 2017-11-06 16:56:19 +01:00
CacheTest.php Use the correct root for shared jail when the source storage is also a jail 2017-11-10 17:03:27 +01:00
CapabilitiesTest.php Update license headers 2017-11-06 16:56:19 +01:00
DeleteOrphanedSharesJobTest.php Update license headers 2017-11-06 16:56:19 +01:00
EncryptedSizePropagationTest.php Update license headers 2017-11-06 16:56:19 +01:00
EtagPropagationTest.php Generate coverage for quick DB tests 2016-10-05 13:55:44 +02:00
ExpireSharesJobTest.php Update license headers 2017-11-06 16:56:19 +01:00
ExternalStorageTest.php Update license headers 2017-11-06 16:56:19 +01:00
GroupEtagPropagationTest.php Update license headers 2017-11-06 16:56:19 +01:00
HelperTest.php Update license headers 2017-11-06 16:56:19 +01:00
LockingTest.php Update with robin 2016-07-21 18:13:58 +02:00
MountProviderTest.php Update license headers 2017-11-06 16:56:19 +01:00
PermissionsTest.php Update with robin 2016-07-21 18:13:58 +02:00
PropagationTestCase.php Update with robin 2016-07-21 18:13:58 +02:00
SharedMountTest.php Update license headers 2017-11-06 16:56:19 +01:00
SharedStorageTest.php Cleanup unused methods 2017-08-15 14:29:26 +02:00
ShareTest.php Cleanup OC_Group usage a bit 2016-11-04 20:55:47 +01:00
SizePropagationTest.php Some app fixes of phpstorm inspections 2017-07-24 11:42:07 +02:00
TestCase.php Remove legacy class OC_Group and OC_User 2017-03-09 17:35:09 -06:00
UnshareChildrenTest.php Some app fixes of phpstorm inspections 2017-07-24 11:42:07 +02:00
UpdaterTest.php Update license headers 2017-11-06 16:56:19 +01:00
WatcherTest.php Update with robin 2016-07-21 18:13:58 +02:00