31 protected array
$get = [
'key_one' => 1,
'key_two' => 2];
32 protected array
$post = [
'key_one' => 1,
'key_two' => 2];
33 protected array
$cookie = [
'key_one' => 1,
'key_two' => 2];
39 protected function setUp(): void
42 $language = $this->getMockBuilder(
'\ilLanguage')
43 ->disableOriginalConstructor()
55 $this->request_interface->expects($this->once())
56 ->method(
'getQueryParams')
59 $wrapper_factory->query();
62 $this->request_interface->expects($this->once())
63 ->method(
'getParsedBody')
66 $wrapper_factory->post();
69 $this->request_interface->expects($this->once())
70 ->method(
'getCookieParams')
73 $wrapper_factory->cookie();
80 $this->request_interface->expects($this->once())
81 ->method(
'getQueryParams')
82 ->willReturn($this->
get);
84 $query = $wrapper_factory->query();
86 $this->assertTrue($query->has(
'key_one'));
87 $this->assertTrue($query->has(
'key_two'));
88 $this->assertFalse($query->has(
'key_three'));
89 $this->assertSame([
'key_one',
'key_two'], $query->keys());
91 $string_trafo = $this->
refinery->kindlyTo()->string();
92 $int_trafo = $this->
refinery->kindlyTo()->int();
94 $this->assertEquals(
"1", $query->retrieve(
'key_one', $string_trafo));
95 $this->assertIsString($query->retrieve(
'key_one', $string_trafo));
97 $this->assertEquals(1, $query->retrieve(
'key_one', $string_trafo));
98 $this->assertIsInt($query->retrieve(
'key_one', $int_trafo));
105 $this->request_interface->expects($this->once())
106 ->method(
'getParsedBody')
107 ->willReturn($this->post);
109 $post = $wrapper_factory->post();
111 $this->assertTrue(
$post->has(
'key_one'));
112 $this->assertTrue(
$post->has(
'key_two'));
113 $this->assertFalse(
$post->has(
'key_three'));
114 $this->assertSame([
'key_one',
'key_two'],
$post->keys());
116 $string_trafo = $this->
refinery->kindlyTo()->string();
117 $int_trafo = $this->
refinery->kindlyTo()->int();
119 $this->assertEquals(
"1",
$post->retrieve(
'key_one', $string_trafo));
120 $this->assertIsString(
$post->retrieve(
'key_one', $string_trafo));
122 $this->assertEquals(1,
$post->retrieve(
'key_one', $string_trafo));
123 $this->assertIsInt(
$post->retrieve(
'key_one', $int_trafo));
130 $this->request_interface->expects($this->once())
131 ->method(
'getCookieParams')
132 ->willReturn($this->cookie);
134 $cookie = $wrapper_factory->cookie();
136 $this->assertTrue(
$cookie->has(
'key_one'));
137 $this->assertTrue(
$cookie->has(
'key_two'));
138 $this->assertFalse(
$cookie->has(
'key_three'));
139 $this->assertSame([
'key_one',
'key_two'],
$cookie->keys());
141 $string_trafo = $this->
refinery->kindlyTo()->string();
142 $int_trafo = $this->
refinery->kindlyTo()->int();
144 $this->assertEquals(
"1",
$cookie->retrieve(
'key_one', $string_trafo));
145 $this->assertIsString(
$cookie->retrieve(
'key_one', $string_trafo));
147 $this->assertEquals(1,
$cookie->retrieve(
'key_one', $string_trafo));
148 $this->assertIsInt(
$cookie->retrieve(
'key_one', $int_trafo));
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.