mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-23 18:03:17 +00:00
App loading optimisation + unit tests to PHP 5.4
This commit is contained in:
@@ -89,9 +89,8 @@ class FailureManagerTest extends \PhraseanetPHPUnitAbstract
|
||||
|
||||
$username = 'romainneutron';
|
||||
|
||||
$phpunit = $this;
|
||||
$oldFailures = $this->ArrayIze(function () use ($phpunit) {
|
||||
return $phpunit->getMock('Alchemy\Phrasea\Model\Entities\AuthFailure');
|
||||
$oldFailures = $this->ArrayIze(function () {
|
||||
return $this->getMock('Alchemy\Phrasea\Model\Entities\AuthFailure');
|
||||
}, 8);
|
||||
|
||||
$repo->expects($this->once())
|
||||
@@ -114,9 +113,8 @@ class FailureManagerTest extends \PhraseanetPHPUnitAbstract
|
||||
|
||||
$username = 'romainneutron';
|
||||
|
||||
$phpunit = $this;
|
||||
$oldFailures = $this->ArrayIze(function () use ($phpunit) {
|
||||
return $phpunit->getMock('Alchemy\Phrasea\Model\Entities\AuthFailure');
|
||||
$oldFailures = $this->ArrayIze(function () {
|
||||
return $this->getMock('Alchemy\Phrasea\Model\Entities\AuthFailure');
|
||||
}, 10);
|
||||
|
||||
$repo->expects($this->once())
|
||||
@@ -139,12 +137,11 @@ class FailureManagerTest extends \PhraseanetPHPUnitAbstract
|
||||
|
||||
$username = 'romainneutron';
|
||||
|
||||
$phpunit = $this;
|
||||
$oldFailures = $this->ArrayIze(function () use ($phpunit) {
|
||||
$failure = $phpunit->getMock('Alchemy\Phrasea\Model\Entities\AuthFailure');
|
||||
$failure->expects($phpunit->once())
|
||||
$oldFailures = $this->ArrayIze(function () {
|
||||
$failure = $this->getMock('Alchemy\Phrasea\Model\Entities\AuthFailure');
|
||||
$failure->expects($this->once())
|
||||
->method('setLocked')
|
||||
->with($phpunit->equalTo(false));
|
||||
->with($this->equalTo(false));
|
||||
|
||||
return $failure;
|
||||
}, 10);
|
||||
@@ -170,9 +167,8 @@ class FailureManagerTest extends \PhraseanetPHPUnitAbstract
|
||||
|
||||
$username = 'romainneutron';
|
||||
|
||||
$phpunit = $this;
|
||||
$oldFailures = $this->ArrayIze(function () use ($phpunit) {
|
||||
return $phpunit->getMock('Alchemy\Phrasea\Model\Entities\AuthFailure');
|
||||
$oldFailures = $this->ArrayIze(function () {
|
||||
return $this->getMock('Alchemy\Phrasea\Model\Entities\AuthFailure');
|
||||
}, 10);
|
||||
|
||||
$repo->expects($this->once())
|
||||
@@ -192,9 +188,8 @@ class FailureManagerTest extends \PhraseanetPHPUnitAbstract
|
||||
|
||||
$username = 'romainneutron';
|
||||
|
||||
$phpunit = $this;
|
||||
$oldFailures = $this->ArrayIze(function () use ($phpunit) {
|
||||
return $phpunit->getMock('Alchemy\Phrasea\Model\Entities\AuthFailure');
|
||||
$oldFailures = $this->ArrayIze(function () {
|
||||
return $this->getMock('Alchemy\Phrasea\Model\Entities\AuthFailure');
|
||||
}, 2);
|
||||
|
||||
$repo->expects($this->once())
|
||||
@@ -230,9 +225,8 @@ class FailureManagerTest extends \PhraseanetPHPUnitAbstract
|
||||
|
||||
$username = 'romainneutron';
|
||||
|
||||
$phpunit = $this;
|
||||
$oldFailures = $this->ArrayIze(function () use ($phpunit) {
|
||||
return $phpunit->getMock('Alchemy\Phrasea\Model\Entities\AuthFailure');
|
||||
$oldFailures = $this->ArrayIze(function () {
|
||||
return $this->getMock('Alchemy\Phrasea\Model\Entities\AuthFailure');
|
||||
}, 3);
|
||||
|
||||
$repo->expects($this->once())
|
||||
|
@@ -110,10 +110,9 @@ class TwitterTest extends ProviderTestCase
|
||||
$request = $this->getRequestMock();
|
||||
$this->addQueryParameter($request, ['state' => $state]);
|
||||
|
||||
$phpunit = $this;
|
||||
$provider->getTwitterClient()->expects($this->any())
|
||||
->method('request')
|
||||
->will($this->returnCallback(function ($method) use ($provider, $phpunit) {
|
||||
->will($this->returnCallback(function ($method) use ($provider) {
|
||||
switch ($method) {
|
||||
case 'POST':
|
||||
$provider->getTwitterClient()->response = [
|
||||
@@ -125,7 +124,7 @@ class TwitterTest extends ProviderTestCase
|
||||
case 'GET':
|
||||
$provider->getTwitterClient()->response = [
|
||||
'response' => json_encode([
|
||||
'id' => $phpunit::ID,
|
||||
'id' => self::ID,
|
||||
])
|
||||
];
|
||||
break;
|
||||
@@ -165,15 +164,14 @@ class TwitterTest extends ProviderTestCase
|
||||
'oauth_token_secret' => 'token secret',
|
||||
]);
|
||||
|
||||
$phpunit = $this;
|
||||
$provider->getTwitterClient()->expects($this->once())
|
||||
->method('request')
|
||||
->will($this->returncallback(function () use ($provider, $phpunit) {
|
||||
->will($this->returncallback(function () use ($provider) {
|
||||
$provider->getTwitterClient()->response = [
|
||||
'response' => json_encode([
|
||||
'screen_name' => $phpunit::USERNAME,
|
||||
'profile_image_url_https' => $phpunit::IMAGEURL,
|
||||
'id' => $phpunit::ID,
|
||||
'screen_name' => self::USERNAME,
|
||||
'profile_image_url_https' => self::IMAGEURL,
|
||||
'id' => self::ID,
|
||||
])
|
||||
];
|
||||
|
||||
|
Reference in New Issue
Block a user