47 $this->markTestSkipped(
'Data Provider needs to be revisited.');
49 $settingsMock = $this->getMockBuilder(
'ilSetting')->disableOriginalConstructor()->onlyMethods([
'set',
'get',
'delete'])->getMock();
51 $settingsMock->expects($this->any())->method(
'set')->will(
52 $this->returnCallback(
function ($key, $value) {
53 $this->storage[$key] = $value;
57 $settingsMock->expects($this->any())->method(
'get')->will(
58 $this->returnCallback(
function ($key, $value) {
59 return $this->storage[$key] ?? $value;
63 $settingsMock->expects($this->any())->method(
'delete')->will(
64 $this->returnCallback(
function ($key, $value) {
65 if (isset($this->storage[$key])) {
66 unset($this->storage[$key]);
71 $valueToTest = $preCallback($value);
74 $registry->setChunkSize($chunkSize);
75 $registry->setStringifiedImports(self::TEST_KEY, $valueToTest);
76 $actual = $registry->getStringifiedImports(self::TEST_KEY);
78 $this->assertEquals($valueToTest, $actual);
79 $this->assertEquals($value, $postCallback($actual));
87 $settingsMock = $this->getMockBuilder(
'ilSetting')->disableOriginalConstructor()->onlyMethods([
'set',
'get',
'delete'])->getMock();
91 $registry->setChunkSize(
'a');
92 $this->fail(
'Failed asserting that exception of type "InvalidArgumentException" is thrown.');
98 $registry->setChunkSize(-5);
99 $this->fail(
'Failed asserting that exception of type "InvalidArgumentException" is thrown.');
115 for ($i = 0; $i < 5; $i++) {
118 $assignment->setImportSkillTitle(
'phpunit' . $i);
119 $assignment->setImportSkillPath(
'phpunit' . $i);
120 $random = new \Random\Randomizer();
121 $assignment->setSkillPoints($random->getInt(0, PHP_INT_MAX));
122 $assignment->setImportQuestionId($random->getInt(0, PHP_INT_MAX));
123 $assignment->setImportSkillBaseId($random->getInt(0, PHP_INT_MAX));
124 $assignment->setImportSkillTrefId($random->getInt(0, PHP_INT_MAX));
126 $assignmentList->addAssignment($assignment);
130 [
'This is a Test', 2],
132 [
'This is a Test with a huge chunk size', 10000],
133 [$assignmentList, 7],
136 foreach ($rawData as $rawItem) {
137 $data[] = [$rawItem[0], $rawItem[1], $pre,
$post];
148 $pre =
function ($value) {
149 return serialize($value);
152 $post =
function ($value) {
153 return unserialize($value);
156 return self::getTestData($pre,
$post);
testSkillAssignmentsCanBetStoredAndFetchedBySerializationStrategy($value, $chunkSize, callable $preCallback, callable $postCallback)
serializedData
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getTestData(callable $pre, callable $post)
const EVAL_MODE_BY_QUESTION_SOLUTION
testInvalidChunkSizeWillRaiseException()