6 require_once
"AbstractBaseTest.php";
30 protected array
$get = [
'key_one' => 1,
'key_two' => 2];
31 protected array
$post = [
'key_one' => 1,
'key_two' => 2];
32 protected array
$cookie = [
'key_one' => 1,
'key_two' => 2];
37 protected function setUp(): void
40 $language = $this->getMockBuilder(
'\ilLanguage')
41 ->disableOriginalConstructor()
53 $this->request_interface->expects($this->once())
54 ->method(
'getQueryParams')
57 $wrapper_factory->query();
60 $this->request_interface->expects($this->once())
61 ->method(
'getParsedBody')
64 $wrapper_factory->post();
67 $this->request_interface->expects($this->once())
68 ->method(
'getCookieParams')
71 $wrapper_factory->cookie();
78 $this->request_interface->expects($this->once())
79 ->method(
'getQueryParams')
80 ->willReturn($this->
get);
82 $query = $wrapper_factory->query();
84 $this->assertTrue(
$query->has(
'key_one'));
85 $this->assertTrue(
$query->has(
'key_two'));
86 $this->assertFalse(
$query->has(
'key_three'));
88 $string_trafo = $this->
refinery->kindlyTo()->string();
89 $int_trafo = $this->
refinery->kindlyTo()->int();
91 $this->assertEquals(
"1",
$query->retrieve(
'key_one', $string_trafo));
92 $this->assertIsString(
$query->retrieve(
'key_one', $string_trafo));
94 $this->assertEquals(1,
$query->retrieve(
'key_one', $string_trafo));
95 $this->assertIsInt(
$query->retrieve(
'key_one', $int_trafo));
102 $this->request_interface->expects($this->once())
103 ->method(
'getParsedBody')
104 ->willReturn($this->post);
106 $post = $wrapper_factory->post();
108 $this->assertTrue($post->has(
'key_one'));
109 $this->assertTrue($post->has(
'key_two'));
110 $this->assertFalse($post->has(
'key_three'));
112 $string_trafo = $this->
refinery->kindlyTo()->string();
113 $int_trafo = $this->
refinery->kindlyTo()->int();
115 $this->assertEquals(
"1", $post->retrieve(
'key_one', $string_trafo));
116 $this->assertIsString($post->retrieve(
'key_one', $string_trafo));
118 $this->assertEquals(1, $post->retrieve(
'key_one', $string_trafo));
119 $this->assertIsInt($post->retrieve(
'key_one', $int_trafo));
126 $this->request_interface->expects($this->once())
127 ->method(
'getCookieParams')
128 ->willReturn($this->cookie);
130 $cookie = $wrapper_factory->cookie();
132 $this->assertTrue($cookie->has(
'key_one'));
133 $this->assertTrue($cookie->has(
'key_two'));
134 $this->assertFalse($cookie->has(
'key_three'));
136 $string_trafo = $this->
refinery->kindlyTo()->string();
137 $int_trafo = $this->
refinery->kindlyTo()->int();
139 $this->assertEquals(
"1", $cookie->retrieve(
'key_one', $string_trafo));
140 $this->assertIsString($cookie->retrieve(
'key_one', $string_trafo));
142 $this->assertEquals(1, $cookie->retrieve(
'key_one', $string_trafo));
143 $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...
array array array $cookie
Class ChatMainBarProvider .
array array array setUp()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...