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
14 changes: 7 additions & 7 deletions components/ILIAS/Bibliographic/tests/ilBibtechParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ protected function setUp(): void
$DIC['ilDB'] = $this->createMock(ilDBInterface::class);
$DIC['refinery'] = new Factory(
new ILIAS\Data\Factory(),
$this->getMockBuilder(ilLanguage::class)->disableOriginalConstructor()->getMock()
$this->createStub(ilLanguage::class)
);
}

Expand All @@ -49,9 +49,9 @@ protected function tearDown(): void

public function testParseBibtechAsArray(): void
{
$ilBiblEntryFactory = $this->createMock(ilBiblEntryFactoryInterface::class);
$ilBiblFieldFactory = $this->createMock(ilBiblFieldFactoryInterface::class);
$ilBiblAttributeFactory = $this->createMock(ilBiblAttributeFactoryInterface::class);
$ilBiblEntryFactory = $this->createStub(ilBiblEntryFactoryInterface::class);
$ilBiblFieldFactory = $this->createStub(ilBiblFieldFactoryInterface::class);
$ilBiblAttributeFactory = $this->createStub(ilBiblAttributeFactoryInterface::class);
$reader = new ilBiblTexFileReader(
$ilBiblEntryFactory,
$ilBiblFieldFactory,
Expand Down Expand Up @@ -97,9 +97,9 @@ public function testParseBibtechAsArray(): void
public function testParseBibtechAsItems(): void
{
$ilBiblEntryFactory = $this->createMock(ilBiblEntryFactoryInterface::class);
$ilBiblFieldFactory = $this->createMock(ilBiblFieldFactoryInterface::class);
$ilBiblAttributeFactory = $this->createMock(ilBiblAttributeFactoryInterface::class);
$ilObjBibliographic = $this->createMock(ilObjBibliographic::class);
$ilBiblFieldFactory = $this->createStub(ilBiblFieldFactoryInterface::class);
$ilBiblAttributeFactory = $this->createStub(ilBiblAttributeFactoryInterface::class);
$ilObjBibliographic = $this->createStub(ilObjBibliographic::class);

$reader = new ilBiblTexFileReader(
$ilBiblEntryFactory,
Expand Down
14 changes: 7 additions & 7 deletions components/ILIAS/Bibliographic/tests/ilRisParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ protected function setUp(): void
$DIC['ilDB'] = $this->createMock(ilDBInterface::class);
$DIC['refinery'] = new Factory(
new ILIAS\Data\Factory(),
$this->getMockBuilder(ilLanguage::class)->disableOriginalConstructor()->getMock()
$this->createStub(ilLanguage::class)
);
}

Expand All @@ -49,9 +49,9 @@ protected function tearDown(): void

public function testParseRisAsArray(): void
{
$ilBiblEntryFactory = $this->createMock(ilBiblEntryFactoryInterface::class);
$ilBiblFieldFactory = $this->createMock(ilBiblFieldFactoryInterface::class);
$ilBiblAttributeFactory = $this->createMock(ilBiblAttributeFactoryInterface::class);
$ilBiblEntryFactory = $this->createStub(ilBiblEntryFactoryInterface::class);
$ilBiblFieldFactory = $this->createStub(ilBiblFieldFactoryInterface::class);
$ilBiblAttributeFactory = $this->createStub(ilBiblAttributeFactoryInterface::class);
$reader = new ilBiblRisFileReader(
$ilBiblEntryFactory,
$ilBiblFieldFactory,
Expand Down Expand Up @@ -94,9 +94,9 @@ public function testParseRisAsArray(): void
public function testParseRisAsItems(): void
{
$ilBiblEntryFactory = $this->createMock(ilBiblEntryFactoryInterface::class);
$ilBiblFieldFactory = $this->createMock(ilBiblFieldFactoryInterface::class);
$ilBiblAttributeFactory = $this->createMock(ilBiblAttributeFactoryInterface::class);
$ilObjBibliographic = $this->createMock(ilObjBibliographic::class);
$ilBiblFieldFactory = $this->createStub(ilBiblFieldFactoryInterface::class);
$ilBiblAttributeFactory = $this->createStub(ilBiblAttributeFactoryInterface::class);
$ilObjBibliographic = $this->createStub(ilObjBibliographic::class);

$reader = new ilBiblRisFileReader(
$ilBiblEntryFactory,
Expand Down
3 changes: 1 addition & 2 deletions components/ILIAS/Cache/tests/CacheTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,9 @@ class CacheTest extends TestCase

protected function setUp(): void
{
$language_mock = $this->createMock(\ilLanguage::class);
$this->refinery = new Factory(
new \ILIAS\Data\Factory(),
$language_mock
$this->createStub(\ilLanguage::class)
);
// prevent chached values between tests
$static_flush = new PHPStatic($this->getConfig(Config::PHPSTATIC));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class ilGlobalCacheSetupAgentTest extends TestCase

public function setUp(): void
{
$refinery = new Refinery($this->createMock(DataFactory::class), $this->createMock(\ilLanguage::class));
$refinery = new Refinery($this->createStub(DataFactory::class), $this->createStub(\ilLanguage::class));

$this->obj = new TestObj($refinery);
}
Expand Down Expand Up @@ -242,7 +242,7 @@ public function testGetMemcachedServerInactive(): void

public function testGetInstallObjectives(): void
{
$setup_conf_mock = $this->createMock(\ilGlobalCacheSettingsAdapter::class);
$setup_conf_mock = $this->createStub(\ilGlobalCacheSettingsAdapter::class);
$objective_collection = $this->obj->getInstallObjective($setup_conf_mock);

$this->assertEquals('Store configuration of components/ILIAS/GlobalCache_', $objective_collection->getLabel());
Expand All @@ -251,7 +251,7 @@ public function testGetInstallObjectives(): void

public function testGetUpdateObjective(): void
{
$setup_conf_mock = $this->createMock(\ilGlobalCacheSettingsAdapter::class);
$setup_conf_mock = $this->createStub(\ilGlobalCacheSettingsAdapter::class);
$objective_collection = $this->obj->getUpdateObjective($setup_conf_mock);

$this->assertEquals('Store configuration of components/ILIAS/GlobalCache_', $objective_collection->getLabel());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,15 @@

class OfComponentTest extends TestCase
{
protected Component $component;
/**
* @var \PHPUnit\Framework\MockObject\Stub&\ILIAS\Component\Component
*/
protected \PHPUnit\Framework\MockObject\Stub $component;
protected D\OfComponent $of_component;

public function setUp(): void
{
$this->component = $this->createMock(Component::class);
$this->component = $this->createStub(Component::class);
$this->of_component = new D\OfComponent(
$this->component
);
Expand Down
24 changes: 12 additions & 12 deletions components/ILIAS/Component/tests/Dependencies/ResolverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function testEmptyComponentSet(): void

public function testResolvePull(): void
{
$component = $this->createMock(Component::class);
$component = $this->createStub(Component::class);

$name = TestInterface::class;

Expand All @@ -69,7 +69,7 @@ public function testPullFailsNotExistent(): void
{
$this->expectException(\LogicException::class);

$component = $this->createMock(Component::class);
$component = $this->createStub(Component::class);

$name = TestInterface::class;

Expand All @@ -84,7 +84,7 @@ public function testPullFailsDuplicate(): void
{
$this->expectException(\LogicException::class);

$component = $this->createMock(Component::class);
$component = $this->createStub(Component::class);

$name = TestInterface::class;

Expand All @@ -101,7 +101,7 @@ public function testPullFailsDuplicate(): void

public function testEmptySeek(): void
{
$component = $this->createMock(Component::class);
$component = $this->createStub(Component::class);

$name = TestInterface::class;

Expand All @@ -116,7 +116,7 @@ public function testEmptySeek(): void

public function testResolveSeek(): void
{
$component = $this->createMock(Component::class);
$component = $this->createStub(Component::class);

$name = TestInterface::class;

Expand Down Expand Up @@ -146,7 +146,7 @@ public function testResolveSeek(): void

public function testResolveUseOneOption(): void
{
$component = $this->createMock(Component::class);
$component = $this->createStub(Component::class);

$name = TestInterface::class;

Expand All @@ -172,7 +172,7 @@ public function testUseFailsNotExistent(): void
{
$this->expectException(\LogicException::class);

$component = $this->createMock(Component::class);
$component = $this->createStub(Component::class);

$name = TestInterface::class;

Expand All @@ -187,7 +187,7 @@ public function testUseFailsDuplicate(): void
{
$this->expectException(\LogicException::class);

$component = $this->createMock(Component::class);
$component = $this->createStub(Component::class);

$name = TestInterface::class;

Expand All @@ -204,7 +204,7 @@ public function testUseFailsDuplicate(): void

public function testUseDisambiguateDuplicateSpecific(): void
{
$component = $this->createMock(Component::class);
$component = $this->createStub(Component::class);

$name = TestInterface::class;

Expand Down Expand Up @@ -238,7 +238,7 @@ public function testUseDisambiguateDuplicateSpecific(): void

public function testUseDisambiguateDuplicateGeneric(): void
{
$component = $this->createMock(Component::class);
$component = $this->createStub(Component::class);

$name = TestInterface::class;

Expand Down Expand Up @@ -275,7 +275,7 @@ public function testFindSimpleCycle(): void
{
$this->expectException(\LogicException::class);

$component = $this->createMock(Component::class);
$component = $this->createStub(Component::class);

$name = TestInterface::class;
$name2 = TestInterface2::class;
Expand All @@ -296,7 +296,7 @@ public function testFindLongerCycle(): void
{
$this->expectException(\LogicException::class);

$component = $this->createMock(Component::class);
$component = $this->createStub(Component::class);

$name = TestInterface::class;
$name2 = TestInterface2::class;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,27 @@

class ilPluginsOverviewTableTest extends TestCase
{
protected ilObjComponentSettingsGUI $parent_gui;
protected ilCtrl $ctrl;
/**
* @var \PHPUnit\Framework\MockObject\Stub&\ilObjComponentSettingsGUI
*/
protected \PHPUnit\Framework\MockObject\Stub $parent_gui;
/**
* @var \PHPUnit\Framework\MockObject\Stub&\ilCtrl
*/
protected \PHPUnit\Framework\MockObject\Stub $ctrl;
protected Factory $ui;
protected Renderer $renderer;
/**
* @var \PHPUnit\Framework\MockObject\Stub&\ILIAS\UI\Renderer
*/
protected \PHPUnit\Framework\MockObject\Stub $renderer;
protected ilLanguage $lng;

protected function setUp(): void
{
$this->parent_gui = $this->createMock(ilObjComponentSettingsGUI::class);
$this->ctrl = $this->createMock(ilCtrl::class);
$this->parent_gui = $this->createStub(ilObjComponentSettingsGUI::class);
$this->ctrl = $this->createStub(ilCtrl::class);
$this->ui = $this->createMock(Factory::class);
$this->renderer = $this->createMock(Renderer::class);
$this->renderer = $this->createStub(Renderer::class);
$this->lng = $this->createMock(ilLanguage::class);
$this->lng->method("txt")
->willReturnCallback(fn($id) => $id);
Expand Down Expand Up @@ -300,7 +309,7 @@ public function withDataWrapper(array $data)

public function testGetActionsPluginNotInstalled(): void
{
$shy = $this->createMock(Shy::class);
$shy = $this->createStub(Shy::class);

$standard = $this->createMock(Standard::class);
$standard
Expand Down Expand Up @@ -368,7 +377,7 @@ protected function getDropdownButton(string $caption, string $command): Shy

public function testGetActionsPluginInstalled(): void
{
$shy = $this->createMock(Shy::class);
$shy = $this->createStub(Shy::class);

$standard = $this->createMock(Standard::class);
$standard
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,10 @@ class ilArtifactComponentRepositoryTest extends TestCase
];

protected Data\Factory $data_factory;
protected Data\Version $ilias_version;
/**
* @var \PHPUnit\Framework\MockObject\Stub&\ILIAS\Data\Version
*/
protected \PHPUnit\Framework\MockObject\Stub $ilias_version;
protected ilPluginStateDB $plugin_state_db;
protected ilArtifactComponentRepository $db;
protected ilComponentInfo $mod1;
Expand All @@ -100,7 +103,7 @@ class ilArtifactComponentRepositoryTest extends TestCase
protected function setUp(): void
{
$this->data_factory = new Data\Factory();
$this->ilias_version = $this->createMock(Data\Version::class);
$this->ilias_version = $this->createStub(Data\Version::class);
$this->plugin_state_db = new class () implements ilPluginStateDB {
public function isPluginActivated(string $id): bool
{
Expand Down Expand Up @@ -491,15 +494,15 @@ public function testSetCurrentPluginVersionCallsStateDB(): void
$DB_VERSION = 1000;

$plugin_state_db = $this->createMock(ilPluginStateDB::class);
$plugin_state_db
$plugin_state_db->expects($this->atLeastOnce())
->method("isPluginActivated")
->with("plg1")
->willReturn(true);
$plugin_state_db
$plugin_state_db->expects($this->atLeastOnce())
->method("getCurrentPluginVersion")
->with("plg1")
->willReturn($this->data_factory->version("1.8.0"));
$plugin_state_db
$plugin_state_db->expects($this->atLeastOnce())
->method("getCurrentPluginDBVersion")
->with("plg1")
->willReturn(42);
Expand Down Expand Up @@ -541,7 +544,7 @@ public function testSetCurrentPluginVersionCallsStateDBTriggersRebuild(): void
$VERSION = $this->data_factory->version("1000.0.0");
$DB_VERSION = 1000;

$plugin_state_db = $this->createMock(ilPluginStateDB::class);
$plugin_state_db = $this->createStub(ilPluginStateDB::class);
$db = new class ($this->data_factory, $plugin_state_db, $this->ilias_version) extends ilArtifactComponentRepository {
public int $build_called = 0;
protected function buildDatabase(): void
Expand Down Expand Up @@ -631,7 +634,7 @@ protected function readPluginData(): array

public function testSetActivationTriggersRebuild(): void
{
$plugin_state_db = $this->createMock(ilPluginStateDB::class);
$plugin_state_db = $this->createStub(ilPluginStateDB::class);
$db = new class ($this->data_factory, $plugin_state_db, $this->ilias_version) extends ilArtifactComponentRepository {
public int $build_called = 0;
protected function buildDatabase(): void
Expand Down Expand Up @@ -710,7 +713,7 @@ protected function readPluginData(): array

public function testRemoveStateInformationOfTriggersRebuild(): void
{
$plugin_state_db = $this->createMock(ilPluginStateDB::class);
$plugin_state_db = $this->createStub(ilPluginStateDB::class);
$db = new class ($this->data_factory, $plugin_state_db, $this->ilias_version) extends ilArtifactComponentRepository {
public int $build_called = 0;
protected function buildDatabase(): void
Expand Down
Loading
Loading