4 require_once(
'./libs/composer/vendor/autoload.php');
51 require_once(
'./Services/WebAccessChecker/classes/class.ilWebAccessChecker.php');
52 require_once(
'./Services/WebAccessChecker/classes/class.ilWACSignedPath.php');
53 require_once(
'./Services/WebAccessChecker/classes/class.ilWACToken.php');
54 require_once(
'./Services/WebAccessChecker/classes/class.ilWebAccessCheckerDelivery.php');
55 $this->root = vfs\vfsStream::setup(
'ilias.de');
56 $this->file_one = vfs\vfsStream::newFile(
'data/trunk/mobs/mm_123/dummy.jpg')
57 ->at($this->root)->setContent(
'dummy');
62 return Mockery::mock(GlobalHttpState::class);
79 public function testDeliver()
81 self::markTestSkipped(
"WIP");
83 $base64 =
"iVBORw0KGgoAAAANSUhEUgAAAEgAAABICAYAAABV7bNHAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyhpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTExIDc5LjE1ODMyNSwgMjAxNS8wOS8xMC0wMToxMDoyMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWR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K76q2NHV+0s25Z74uihLYooKeVyw0dviBce02Pf+kfa3jePM2+MQUxya/uKRtYzP+AUv/7y6D9OVVe9DAlpMYw7A4NCxjEsp6LETpa9+w4QCggdVDMxwVRbmi/V1ZaDH3zl7MlvttptrVe8FS11nl2XTvTjM4lhigP5Zi1H+xIt0woU81oZVo2DzWbXd3cUFhaiPXv2eHVSTqVODTdbpoWGR07VG005PK+K7KAHrgT1qoC1AULpR3tya7PbbNVNDZf2f1d3YXvd+XM7ZdF5qsvaD0KWlSj2VTiNUUG++XYW12I7JKjkwvwnHti9tdSlQUVFRUin03nFUSAhPS4r8nFw4k9rVSRAb9Qk6QzGNL3BlKjWaKKBpQfBjjrXdV21K2yVJLEBtOKcraXlZGuLtRp829ctsv20xqSTQo1xaGhyosv34C7MF8je6TKEiwjyfbt+blYKTx8zHvyKLi9r0oMyCNAgQIMA9YL8X4ABAIDrBNX7nKxZAAAAAElFTkSuQmCC";
84 $image = vfs\vfsStream::newFile(
'data/trunk/mobs/mm_123/dummy.png')->at($this->root)
85 ->setContent($base64);
86 $this->assertEquals($base64, $image->getContent());
88 require_once(
'./Services/PHPUnit/classes/class.ilUnitUtil.php');
90 $GLOBALS[
'DIC'][
'ilAuthSession']->setAuthenticated(
true, ANONYMOUS_USER_ID);
91 ilUnitUtil::performInitialisation();
102 ob_start(
function ($buffer) {
115 $request = Mockery::mock(ServerRequestInterface::class);
119 $uri = Mockery::mock(UriInterface::class);
122 ->shouldReceive(
'getPath')
125 ->andReturn($image->url());
128 ->shouldReceive(
'getUri')
134 ->shouldReceive(
'request')
142 $this->assertEquals(404, $this->response()->getStatusCode());
148 self::markTestSkipped(
"Can't run test without db.");
152 require_once(
'./Services/User/classes/class.ilObjUser.php');
156 $check = $ilWebAccessChecker->
check();
160 $this->assertFalse($check);
161 $this->assertEquals(array(
162 $ilWebAccessChecker::CM_CHECKINGINSTANCE,
163 ), $ilWebAccessChecker->getAppliedCheckingMethods());
169 self::markTestSkipped(
"WIP");
176 $check = $ilWebAccessChecker->check();
180 $this->assertTrue($check);
181 $this->assertEquals(array(
182 $ilWebAccessChecker::CM_FILE_TOKEN,
183 ), $ilWebAccessChecker->getAppliedCheckingMethods());
185 $headerName =
'X-ILIAS-WebAccessChecker';
187 $this->assertTrue(
$response->hasHeader($headerName));
188 $this->assertEquals([
'checked using token' ],
$response->getHeader($headerName));
194 self::markTestSkipped(
"WIP");
200 $check = $ilWebAccessChecker->check();
204 $this->assertTrue($check);
205 $this->assertEquals(array(
206 $ilWebAccessChecker::CM_FOLDER_TOKEN,
207 ), $ilWebAccessChecker->getAppliedCheckingMethods());
209 $headerName =
'X-ILIAS-WebAccessChecker';
211 $this->assertTrue(
$response->hasHeader($headerName));
212 $this->assertEquals([
'checked using secure folder' ],
$response->getHeader($headerName));
221 self::markTestSkipped(
"Can't run test without db.");
225 $file = vfs\vfsStream::newFile(
'data/trunk/dummy/mm_123/dummy.jpg')->at($this->root)
226 ->setContent(
'dummy');
230 if (!defined(
'IL_PHPUNIT_TEST')) {
231 define(
'IL_PHPUNIT_TEST',
true);
233 session_id(
'phpunittest');
235 include
'Services/PHPUnit/config/cfg.phpunit.php';
237 $check = $ilWebAccessChecker->
check();
TestCase for the ilWACCheckingInstanceTest.
foreach($paths as $path) $request
testBasicWithFileSigning()
static signFolderOfStartFile($start_file_path)
testBasicWithFolderSigning()
static http()
Fetches the global http state from ILIAS.
Class ilWebAccessChecker.
testNonCheckingInstanceNoSec()
static signFile($path_to_file)
const ACCESS_DENIED_NO_PUB
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
static run(GlobalHttpState $httpState, CookieFactory $cookieFactory)