1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* @license LGPLv3, http://opensource.org/licenses/LGPL-3.0 |
5
|
|
|
* @copyright Metaways Infosystems GmbH, 2011 |
6
|
|
|
* @copyright Aimeos (aimeos.org), 2014-2020 |
7
|
|
|
*/ |
8
|
|
|
|
9
|
|
|
|
10
|
|
|
namespace Aimeos\MW\Session; |
11
|
|
|
|
12
|
|
|
|
13
|
|
|
require_once __DIR__ . DIRECTORY_SEPARATOR . 'AbstractUserAuthentication'; |
14
|
|
|
|
15
|
|
|
|
16
|
|
|
class Typo3Test extends \PHPUnit\Framework\TestCase |
17
|
|
|
{ |
18
|
|
|
private $object; |
19
|
|
|
|
20
|
|
|
|
21
|
|
|
protected function setUp() : void |
22
|
|
|
{ |
23
|
|
|
$mock = new \TYPO3\CMS\Core\Authentication\AbstractUserAuthentication(); |
24
|
|
|
$this->object = new \Aimeos\MW\Session\Typo3( $mock ); |
25
|
|
|
} |
26
|
|
|
|
27
|
|
|
|
28
|
|
|
protected function tearDown() : void |
29
|
|
|
{ |
30
|
|
|
unset( $this->object ); |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
|
34
|
|
|
public function testDel() |
35
|
|
|
{ |
36
|
|
|
$this->object->set( 'test', '123456789' ); |
37
|
|
|
$this->assertEquals( '123456789', $this->object->get( 'test' ) ); |
38
|
|
|
|
39
|
|
|
$result = $this->object->del( 'test' ); |
40
|
|
|
|
41
|
|
|
$this->assertInstanceOf( \Aimeos\MW\Session\Iface::class, $result ); |
42
|
|
|
$this->assertEquals( null, $this->object->get( 'test' ) ); |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
|
46
|
|
|
public function testGet() |
47
|
|
|
{ |
48
|
|
|
$this->assertEquals( null, $this->object->get( 'test' ) ); |
49
|
|
|
|
50
|
|
|
$this->object->set( 'test', '123456789' ); |
51
|
|
|
$this->assertEquals( '123456789', $this->object->get( 'test' ) ); |
52
|
|
|
|
53
|
|
|
$this->object->set( 'test', ['123456789'] ); |
54
|
|
|
$this->assertEquals( ['123456789'], $this->object->get( 'test' ) ); |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
|
58
|
|
|
public function testPull() |
59
|
|
|
{ |
60
|
|
|
$this->object->set( 'test', '123456789' ); |
61
|
|
|
$this->assertEquals( '123456789', $this->object->get( 'test' ) ); |
62
|
|
|
|
63
|
|
|
$this->assertEquals( '123456789', $this->object->pull( 'test' ) ); |
64
|
|
|
$this->assertEquals( null, $this->object->pull( 'test' ) ); |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
|
68
|
|
|
public function testRemove() |
69
|
|
|
{ |
70
|
|
|
$this->object->set( 'test', '123456789' ); |
71
|
|
|
$this->assertEquals( '123456789', $this->object->get( 'test' ) ); |
72
|
|
|
|
73
|
|
|
$result = $this->object->remove( ['test'] ); |
74
|
|
|
|
75
|
|
|
$this->assertInstanceOf( \Aimeos\MW\Session\Iface::class, $result ); |
76
|
|
|
$this->assertEquals( null, $this->object->get( 'test' ) ); |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
|
80
|
|
|
public function testSet() |
81
|
|
|
{ |
82
|
|
|
$this->object->set( 'test', null ); |
83
|
|
|
$this->assertEquals( null, $this->object->get( 'test' ) ); |
84
|
|
|
|
85
|
|
|
$result = $this->object->set( 'test', '234' ); |
86
|
|
|
|
87
|
|
|
$this->assertInstanceOf( \Aimeos\MW\Session\Iface::class, $result ); |
88
|
|
|
$this->assertEquals( '234', $this->object->get( 'test' ) ); |
89
|
|
|
} |
90
|
|
|
} |
91
|
|
|
|