Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 28 additions & 28 deletions components/ILIAS/DataProtection/tests/ConsumerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@ public function testDisabledUses(): void
'settings' => $settings,
'refinery' => ['byTrying' => $by_trying],
]);
$container->method('offsetGet')->with('ilObjDataCache')->willReturn($this->mock(ilObjectDataCache::class));
$container->expects($this->once())->method('offsetGet')->with('ilObjDataCache')->willReturn($this->mock(ilObjectDataCache::class));

$slot = $this->mock(UseSlot::class);
$slot->expects(self::once())->method('hasDocuments')->willReturn($slot);
$slot->expects(self::once())->method('hasHistory')->willReturn($slot);
$slot->expects(self::once())->method('hasPublicApi')->willReturn($slot);
$slot->expects(self::once())->method('hasPublicPage')->willReturn($slot);
$slot->expects(self::once())->method('showInFooter')->willReturn($slot);
$slot->expects($this->once())->method('hasDocuments')->willReturn($slot);
$slot->expects($this->once())->method('hasHistory')->willReturn($slot);
$slot->expects($this->once())->method('hasPublicApi')->willReturn($slot);
$slot->expects($this->once())->method('hasPublicPage')->willReturn($slot);
$slot->expects($this->once())->method('showInFooter')->willReturn($slot);

$instance = new Consumer($container);

Expand All @@ -75,7 +75,7 @@ public function testUsesWithoutAcceptance(): void
$by_trying = $this->mockTree(ByTrying::class, ['transform' => true]);
$settings = $this->mock(ilSetting::class);
$consecutive = ['dpro_enabled', 'dpro_no_acceptance'];
$settings->method('get')->with(
$settings->expects($this->exactly(2))->method('get')->with(
$this->callback(function ($value) use (&$consecutive) {
$this->assertSame(array_shift($consecutive), $value);
return true;
Expand All @@ -88,15 +88,15 @@ public function testUsesWithoutAcceptance(): void
'refinery' => ['byTrying' => $by_trying],
'ctrl' => $this->mock(ilCtrl::class),
]);
$container->method('offsetGet')->with('ilObjDataCache')->willReturn($this->mock(ilObjectDataCache::class));
$container->expects($this->once())->method('offsetGet')->with('ilObjDataCache')->willReturn($this->mock(ilObjectDataCache::class));

$slot = $this->mock(UseSlot::class);
$slot->expects(self::once())->method('hasDocuments')->willReturn($slot);
$slot->expects(self::once())->method('hasHistory')->willReturn($slot);
$slot->expects(self::once())->method('showOnLoginPage')->willReturn($slot);
$slot->expects(self::once())->method('showInFooter')->willReturn($slot);
$slot->expects(self::once())->method('hasPublicPage')->willReturn($slot);
$slot->expects(self::once())->method('hasPublicApi')->willReturn($slot);
$slot->expects($this->once())->method('hasDocuments')->willReturn($slot);
$slot->expects($this->once())->method('hasHistory')->willReturn($slot);
$slot->expects($this->once())->method('showOnLoginPage')->willReturn($slot);
$slot->expects($this->once())->method('showInFooter')->willReturn($slot);
$slot->expects($this->once())->method('hasPublicPage')->willReturn($slot);
$slot->expects($this->once())->method('hasPublicApi')->willReturn($slot);

$instance = new Consumer($container);

Expand All @@ -110,7 +110,7 @@ public function testUses(): void

$settings = $this->mock(ilSetting::class);
$consecutive = ['dpro_enabled', 'dpro_no_acceptance'];
$settings->method('get')->with(
$settings->expects($this->exactly(2))->method('get')->with(
$this->callback(function ($value) use (&$consecutive) {
$this->assertSame(array_shift($consecutive), $value);
return true;
Expand All @@ -123,21 +123,21 @@ public function testUses(): void
'refinery' => ['byTrying' => $by_trying],
'ctrl' => $this->mock(ilCtrl::class),
]);
$container->method('offsetGet')->with('ilObjDataCache')->willReturn($this->mock(ilObjectDataCache::class));
$container->expects($this->once())->method('offsetGet')->with('ilObjDataCache')->willReturn($this->mock(ilObjectDataCache::class));

$slot = $this->mock(UseSlot::class);
$slot->expects(self::once())->method('hasDocuments')->willReturn($slot);
$slot->expects(self::once())->method('hasHistory')->willReturn($slot);
$slot->expects(self::once())->method('showOnLoginPage')->willReturn($slot);
$slot->expects(self::once())->method('canWithdraw')->willReturn($slot);
$slot->expects(self::once())->method('hasAgreement')->willReturn($slot);
$slot->expects(self::once())->method('showInFooter')->willReturn($slot);
$slot->expects(self::once())->method('onSelfRegistration')->willReturn($slot);
$slot->expects(self::once())->method('hasOnlineStatusFilter')->willReturn($slot);
$slot->expects(self::once())->method('hasUserManagementFields')->willReturn($slot);
$slot->expects(self::once())->method('hasPublicApi')->willReturn($slot);
$slot->expects(self::once())->method('canReadInternalMails')->willReturn($slot);
$slot->expects(self::once())->method('canUseSoapApi')->willReturn($slot);
$slot->expects($this->once())->method('hasDocuments')->willReturn($slot);
$slot->expects($this->once())->method('hasHistory')->willReturn($slot);
$slot->expects($this->once())->method('showOnLoginPage')->willReturn($slot);
$slot->expects($this->once())->method('canWithdraw')->willReturn($slot);
$slot->expects($this->once())->method('hasAgreement')->willReturn($slot);
$slot->expects($this->once())->method('showInFooter')->willReturn($slot);
$slot->expects($this->once())->method('onSelfRegistration')->willReturn($slot);
$slot->expects($this->once())->method('hasOnlineStatusFilter')->willReturn($slot);
$slot->expects($this->once())->method('hasUserManagementFields')->willReturn($slot);
$slot->expects($this->once())->method('hasPublicApi')->willReturn($slot);
$slot->expects($this->once())->method('canReadInternalMails')->willReturn($slot);
$slot->expects($this->once())->method('canUseSoapApi')->willReturn($slot);

$instance = new Consumer($container);

Expand Down
2 changes: 1 addition & 1 deletion components/ILIAS/DataProtection/tests/SettingsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ private function assertSelect(string $method, string $key, string $type): void
$marshal = $this->mockMethod(Marshal::class, $type, [], $convert);

$settings = $this->mock(SelectSetting::class);
$settings->expects(self::once())->method('typed')->willReturnCallback(function (string $k, callable $select) use ($marshal, $convert, $setting, $key) {
$settings->expects($this->once())->method('typed')->willReturnCallback(function (string $k, callable $select) use ($marshal, $convert, $setting, $key) {
$this->assertSame($key, $k);
$this->assertSame($convert, $select($marshal));
return $setting;
Expand Down
6 changes: 3 additions & 3 deletions components/ILIAS/DataProtection/tests/UserSettingsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function testWithdrawalRequested(): void
$marshal = $this->mockMethod(Marshal::class, 'boolean', [], $convert);

$settings = $this->mock(SelectSetting::class);
$settings->expects(self::once())->method('typed')->willReturnCallback(function (string $key, callable $select) use ($marshal, $convert, $setting) {
$settings->expects($this->once())->method('typed')->willReturnCallback(function (string $key, callable $select) use ($marshal, $convert, $setting) {
$this->assertSame('dpro_withdrawal_requested', $key);
$this->assertSame($convert, $select($marshal));
return $setting;
Expand All @@ -64,10 +64,10 @@ public function testAgreeDate(): void
$date = $this->mock(Convert::class);

$marshal = $this->mockMethod(Marshal::class, 'nullable', [$date], $convert);
$marshal->expects(self::once())->method('dateTime')->willReturn($date);
$marshal->expects($this->once())->method('dateTime')->willReturn($date);

$settings = $this->mock(SelectSetting::class);
$settings->expects(self::once())->method('typed')->willReturnCallback(function (string $key, callable $select) use ($marshal, $convert, $setting) {
$settings->expects($this->once())->method('typed')->willReturnCallback(function (string $key, callable $select) use ($marshal, $convert, $setting) {
$this->assertSame('dpro_agree_date', $key);
$this->assertSame($convert, $select($marshal));
return $setting;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function testMethods(string $method, string $target, int $argc): void

$args = array_slice($args, 0, $argc);

$admin->expects(self::once())->method($target)->with($gui, ...[...$args, $method])->willReturn('my-link');
$admin->expects($this->once())->method($target)->with($gui, ...[...$args, $method])->willReturn('my-link');

$instance = new AdministrationEditLinks($gui, $admin);
$this->assertSame('my-link', $instance->$method(...$args));
Expand Down
10 changes: 5 additions & 5 deletions components/ILIAS/LegalDocuments/tests/AdministrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public function testDeleteDocuments(): void
$repository = $this->getMockBuilder(DocumentRepository::class)->getMock();

$consecutive = $documents;
$repository->expects(self::exactly(count($documents)))->method('deleteDocument')->with(
$repository->expects($this->exactly(count($documents)))->method('deleteDocument')->with(
$this->callback(function ($value) use (&$consecutive) {
$this->assertSame(array_shift($consecutive), $value);
return true;
Expand Down Expand Up @@ -153,8 +153,8 @@ public function testWithDocumentAndCriterion(): void
'getQueryParams',
[],
$query_params,
self::exactly(1)
), self::exactly(1));
$this->exactly(1)
), $this->exactly(1));
$http->method('wrapper')->willReturn($httpWrapper);

$refinery = $this->mockMethod(Refinery::class, 'kindlyTo', [], $this->mockMethod(KindlyToGroup::class, 'int', [], $this->mockMethod(
Expand All @@ -180,8 +180,8 @@ public function testWithDocumentAndCriterion(): void
private function doc(int $id, string $title): Document
{
$document = $this->getMockBuilder(Document::class)->disableOriginalConstructor()->getMock();
$document->expects(self::once())->method('id')->willReturn($id);
$document->expects(self::once())->method('content')->willReturn(
$document->expects($this->once())->method('id')->willReturn($id);
$document->expects($this->once())->method('content')->willReturn(
$this->mockMethod(DocumentContent::class, 'title', [], $title)
);

Expand Down
8 changes: 4 additions & 4 deletions components/ILIAS/LegalDocuments/tests/ConductorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public function testModifyFooter(): void
public function testAgree(string $gui, string $key): void
{
$main_template = $this->mock(ilGlobalTemplateInterface::class);
$main_template->expects(self::once())->method('setContent')->with('rendered');
$main_template->expects($this->once())->method('setContent')->with('rendered');
$this->agreement('agree', $gui, $key, $main_template);
}

Expand All @@ -155,7 +155,7 @@ public function testRedirectAgreeContent(): void
{
$this->expectExceptionMessage('Not available.');
$routing = $this->mock(Routing::class);
$routing->expects(self::once())->method('redirectToOriginalTarget');
$routing->expects($this->once())->method('redirectToOriginalTarget');
$constraint = $this->mock(Constraint::class);
$container = $this->mockTree(Container::class, [
'refinery' => ['to' => ['string' => $constraint]],
Expand All @@ -172,7 +172,7 @@ public function testRedirectAgreeContent(): void
public function testWithdraw(): void
{
$main_template = $this->mock(ilGlobalTemplateInterface::class);
$main_template->expects(self::once())->method('setContent')->with('rendered');
$main_template->expects($this->once())->method('setContent')->with('rendered');
$this->agreement('withdraw', 'foo', 'withdraw', $main_template);
}

Expand Down Expand Up @@ -320,7 +320,7 @@ private function agreement(string $method, string $gui, string $key, ?ilGlobalTe
$constraint = $this->mock(Constraint::class);

$ctrl = $this->mock(ilCtrl::class);
$ctrl->expects(self::once())->method('setParameterByClass')->with($gui, 'id', 'foo');
$ctrl->expects($this->once())->method('setParameterByClass')->with($gui, 'id', 'foo');

$container = $this->mockTree(Container::class, [
'refinery' => ['to' => ['string' => $constraint]],
Expand Down
2 changes: 1 addition & 1 deletion components/ILIAS/LegalDocuments/tests/ConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function testEditableLegalDocuments(): void

public function testNonEditableLegalDocuments(): void
{
$provide = $this->mockMethod(Provide::class, 'allowEditing', [], $this->mock(Provide::class), self::never());
$provide = $this->mockMethod(Provide::class, 'allowEditing', [], $this->mock(Provide::class), $this->never());
$this->assertSame($provide, (new Config($provide))->legalDocuments());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function testUserCreation(): void
{
$user = $this->mock(ilObjUser::class);
$self_registration = $this->mock(SelfRegistration::class);
$self_registration->expects(self::exactly(2))->method('userCreation')->with($user);
$self_registration->expects($this->exactly(2))->method('userCreation')->with($user);

$bundle = new Bundle([
$self_registration,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ public function testGlobalStore(): void
public function testUi(): void
{
$container = $this->mock(Container::class);
$container->expects(self::once())->method('ui')->willReturn($this->mock(UIServices::class));
$container->expects(self::once())->method('language')->willReturn($this->mock(ilLanguage::class));
$container->expects($this->once())->method('ui')->willReturn($this->mock(UIServices::class));
$container->expects($this->once())->method('language')->willReturn($this->mock(ilLanguage::class));

$instance = new Blocks(
'foo',
Expand Down Expand Up @@ -145,8 +145,8 @@ public function testRetrieveQueryParameter(): void
public function testUserManagementAgreeDateField(): void
{
$result = $this->mockTree(Result::class, ['value' => 'dummy']);
$result->expects(self::once())->method('map')->willReturn($result);
$result->expects(self::once())->method('except')->willReturn($result);
$result->expects($this->once())->method('map')->willReturn($result);
$result->expects($this->once())->method('except')->willReturn($result);
$user = $this->mock(ilObjUser::class);
$date = new DateTimeImmutable();
$ldoc_user = $this->mockTree(User::class, [
Expand All @@ -156,7 +156,7 @@ public function testUserManagementAgreeDateField(): void

$language = $this->mock(ilLanguage::class);
$consecutive = ['dummy lang', 'ldoc'];
$language->expects(self::exactly(2))->method('loadLanguageModule')->with(
$language->expects($this->exactly(2))->method('loadLanguageModule')->with(
$this->callback(function ($value) use (&$consecutive) {
$this->assertSame(array_shift($consecutive), $value);
return true;
Expand Down Expand Up @@ -190,8 +190,8 @@ public function testWithRequest(): void
]);

$form = $this->mock(Form::class);
$form->expects(self::once())->method('withRequest')->with($container->http()->request())->willReturn($form);
$form->expects(self::once())->method('getData')->willReturn($data);
$form->expects($this->once())->method('withRequest')->with($container->http()->request())->willReturn($form);
$form->expects($this->once())->method('getData')->willReturn($data);

$instance = new Blocks('foo', $container, $this->mock(Provide::class));
$this->assertSame($form, $instance->withRequest($form, function ($x) use ($data, &$called) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ public function testRenderModal(): void
public function testWithdrawalButton(): void
{
$template = $this->mock(ilTemplate::class);
$template->expects(self::exactly(3))->method('setVariable');
$template->expects(self::once())->method('get');
$template->expects($this->exactly(3))->method('setVariable');
$template->expects($this->once())->method('get');

$instance = new ModifyFooter(
$this->mock(UI::class),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@ public function testSaveLegacyFormFailed(): void
);

$checkbox = $this->mock(ilCheckboxInputGUI::class);
$checkbox->expects(self::once())->method('setAlert');
$checkbox->expects($this->once())->method('setAlert');

$form = $this->mockTree(ilPropertyFormGUI::class, ['getInput' => false]);
$form->expects(self::once())->method('getItemByPostVar')->with('accept_foo')->willReturn($checkbox);
$form->expects($this->once())->method('getItemByPostVar')->with('accept_foo')->willReturn($checkbox);

$this->assertFalse($instance->saveLegacyForm($form));
}
Expand All @@ -105,7 +105,7 @@ public function testUserCreation(): void
{
$user = $this->mock(ilObjUser::class);
$ldoc_user = $this->mock(User::class);
$ldoc_user->expects(self::once())->method('acceptMatchingDocument');
$ldoc_user->expects($this->once())->method('acceptMatchingDocument');

$instance = new SelfRegistration(
'foo',
Expand All @@ -127,11 +127,11 @@ public function testUserCreationFailed(): void
{
$user = $this->mock(ilObjUser::class);
$ldoc_user = $this->mock(User::class);
$ldoc_user->expects(self::once())->method('acceptMatchingDocument')->willReturnCallback(function () {
$ldoc_user->expects($this->once())->method('acceptMatchingDocument')->willReturnCallback(function () {
throw new \ILIAS\Data\NotOKException('This is not ok.');
});

$ldoc_user->expects(self::once())->method('acceptAnyDocument');
$ldoc_user->expects($this->once())->method('acceptAnyDocument');

$instance = new SelfRegistration(
'foo',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function testInvoke(): void
['HREF', $url]
];
$template
->expects(self::exactly(2))
->expects($this->exactly(2))
->method('setVariable')
->willReturnCallback(
function (string $k, string $v) use (&$expected) {
Expand All @@ -77,7 +77,7 @@ function (string $k, string $v) use (&$expected) {
}
);

$template->expects(self::once())->method('get')->willReturn('Rendered');
$template->expects($this->once())->method('get')->willReturn('Rendered');

$instance = new ShowOnLoginPage($this->mockTree(Provide::class, [
'document' => ['repository' => ['countAll' => 1]],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public function testIsOnGoing(): void
public function testWithdrawalRequested(): void
{
$setting = $this->mock(Setting::class);
$setting->expects(self::once())->method('update')->with(true);
$setting->expects($this->once())->method('update')->with(true);

$instance = new WithdrawProcess(
$this->mockTree(User::class, ['cannotAgree' => false, 'neverAgreed' => false, 'withdrawalRequested' => $setting]),
Expand Down Expand Up @@ -125,7 +125,7 @@ public function testWithdrawalRequestedWithInvalidUser(): void
public function testWithdrawalFinished(): void
{
$main_template = $this->mock(ilGlobalTemplateInterface::class);
$main_template->expects(self::once())->method('setOnScreenMessage');
$main_template->expects($this->once())->method('setOnScreenMessage');

$instance = new WithdrawProcess(
$this->mock(User::class),
Expand Down
Loading
Loading