Fix form tests utilizing Mockery's partial mock functionality

Since an update of Mockery, partial mocks do not call the constructor
of their mocked classes anymore without explicitly passing a non empty
array. This is a regression of the following bug:
https://github.com/padraic/mockery/issues/144
This commit is contained in:
Johannes Meyer 2015-04-30 15:20:19 +02:00
parent d27b94dcec
commit 034421d0cb
3 changed files with 12 additions and 6 deletions

View File

@ -31,7 +31,8 @@ class DbBackendFormTest extends BaseTestCase
->shouldReceive('count')
->andReturn(2);
$form = Mockery::mock('Icinga\Forms\Config\Authentication\DbBackendForm[getView]');
// Passing array(null) is required to make Mockery call the constructor...
$form = Mockery::mock('Icinga\Forms\Config\Authentication\DbBackendForm[getView]', array(null));
$form->shouldReceive('getView->escape')
->with(Mockery::type('string'))
->andReturnUsing(function ($s) { return $s; });
@ -56,7 +57,8 @@ class DbBackendFormTest extends BaseTestCase
->shouldReceive('count')
->andReturn(0);
$form = Mockery::mock('Icinga\Forms\Config\Authentication\DbBackendForm[getView]');
// Passing array(null) is required to make Mockery call the constructor...
$form = Mockery::mock('Icinga\Forms\Config\Authentication\DbBackendForm[getView]', array(null));
$form->shouldReceive('getView->escape')
->with(Mockery::type('string'))
->andReturnUsing(function ($s) { return $s; });

View File

@ -31,7 +31,8 @@ class LdapBackendFormTest extends BaseTestCase
Mockery::mock('overload:Icinga\Authentication\Backend\LdapUserBackend')
->shouldReceive('assertAuthenticationPossible')->andReturnNull();
$form = Mockery::mock('Icinga\Forms\Config\Authentication\LdapBackendForm[getView]');
// Passing array(null) is required to make Mockery call the constructor...
$form = Mockery::mock('Icinga\Forms\Config\Authentication\LdapBackendForm[getView]', array(null));
$form->shouldReceive('getView->escape')
->with(Mockery::type('string'))
->andReturnUsing(function ($s) { return $s; });
@ -55,7 +56,8 @@ class LdapBackendFormTest extends BaseTestCase
Mockery::mock('overload:Icinga\Authentication\Backend\LdapUserBackend')
->shouldReceive('assertAuthenticationPossible')->andThrow(new AuthenticationException);
$form = Mockery::mock('Icinga\Forms\Config\Authentication\LdapBackendForm[getView]');
// Passing array(null) is required to make Mockery call the constructor...
$form = Mockery::mock('Icinga\Forms\Config\Authentication\LdapBackendForm[getView]', array(null));
$form->shouldReceive('getView->escape')
->with(Mockery::type('string'))
->andReturnUsing(function ($s) { return $s; });

View File

@ -29,7 +29,8 @@ class LdapResourceFormTest extends BaseTestCase
Mockery::mock()->shouldReceive('testCredentials')->once()->andReturn(true)->getMock()
);
$form = Mockery::mock('Icinga\Forms\Config\Resource\LdapResourceForm[getView]');
// Passing array(null) is required to make Mockery call the constructor...
$form = Mockery::mock('Icinga\Forms\Config\Resource\LdapResourceForm[getView]', array(null));
$form->shouldReceive('getView->escape')
->with(Mockery::type('string'))
->andReturnUsing(function ($s) { return $s; });
@ -51,7 +52,8 @@ class LdapResourceFormTest extends BaseTestCase
Mockery::mock()->shouldReceive('testCredentials')->once()->andThrow('\Exception')->getMock()
);
$form = Mockery::mock('Icinga\Forms\Config\Resource\LdapResourceForm[getView]');
// Passing array(null) is required to make Mockery call the constructor...
$form = Mockery::mock('Icinga\Forms\Config\Resource\LdapResourceForm[getView]', array(null));
$form->shouldReceive('getView->escape')
->with(Mockery::type('string'))
->andReturnUsing(function ($s) { return $s; });