1 | <?php |
||
2 | |||
3 | namespace BasicTests; |
||
4 | |||
5 | |||
6 | use CommonTestClass; |
||
7 | use kalanis\kw_input\Entries; |
||
8 | use kalanis\kw_input\Interfaces; |
||
9 | |||
10 | |||
11 | class EntryTest extends CommonTestClass |
||
12 | { |
||
13 | public function testEntry(): void |
||
14 | { |
||
15 | $data = new Entries\Entry(); |
||
16 | $this->assertInstanceOf(Interfaces\IEntry::class, $data); |
||
17 | |||
18 | $this->assertEmpty($data->getSource()); |
||
19 | $this->assertEmpty($data->getKey()); |
||
20 | $this->assertEmpty($data->__toString()); |
||
21 | |||
22 | $data->setEntry('different', 'foz', 'wuz'); |
||
23 | $this->assertEmpty($data->getSource()); |
||
24 | $this->assertEquals('foz', $data->getKey()); |
||
25 | $this->assertEquals('wuz', $data->getValue()); |
||
26 | |||
27 | $data->setEntry(Interfaces\IEntry::SOURCE_GET, 'ugg', 'huu'); |
||
28 | $this->assertEquals(Interfaces\IEntry::SOURCE_GET, $data->getSource()); |
||
29 | $this->assertEquals('ugg', $data->getKey()); |
||
30 | $this->assertEquals('huu', $data->getValue()); |
||
31 | |||
32 | $data->setEntry(Interfaces\IEntry::SOURCE_POST, 'aqq'); |
||
33 | $this->assertEquals(Interfaces\IEntry::SOURCE_POST, $data->getSource()); |
||
34 | $this->assertEquals('aqq', $data->getKey()); |
||
35 | $this->assertEmpty($data->getValue()); |
||
0 ignored issues
–
show
|
|||
36 | } |
||
37 | |||
38 | public function testFile(): void |
||
39 | { |
||
40 | $data = new Entries\FileEntry(); |
||
41 | $this->assertInstanceOf(Interfaces\IEntry::class, $data); |
||
42 | $this->assertInstanceOf(Interfaces\IFileEntry::class, $data); |
||
43 | |||
44 | $this->assertEquals(Interfaces\IEntry::SOURCE_FILES, $data->getSource()); |
||
45 | $this->assertEmpty($data->getKey()); |
||
46 | $this->assertEmpty($data->getValue()); |
||
47 | $this->assertEmpty($data->getMimeType()); |
||
48 | $this->assertEmpty($data->getTempName()); |
||
49 | $this->assertEmpty($data->getError()); |
||
50 | $this->assertEmpty($data->getSize()); |
||
51 | |||
52 | $data->setEntry('different', 'foz', 'wuz'); |
||
53 | $this->assertEquals(Interfaces\IEntry::SOURCE_FILES, $data->getSource()); |
||
54 | $this->assertEquals('foz', $data->getKey()); |
||
55 | $this->assertEquals('wuz', $data->getValue()); |
||
56 | $this->assertEmpty($data->getMimeType()); |
||
57 | $this->assertEmpty($data->getTempName()); |
||
58 | $this->assertEmpty($data->getError()); |
||
59 | $this->assertEmpty($data->getSize()); |
||
60 | |||
61 | $data->setEntry(Interfaces\IEntry::SOURCE_GET, 'ugg', 'huu'); |
||
62 | $data->setFile('foo', 'uff', 'octet', 15, 20); |
||
63 | $this->assertEquals(Interfaces\IEntry::SOURCE_FILES, $data->getSource()); |
||
64 | $this->assertEquals('ugg', $data->getKey()); |
||
65 | $this->assertEquals('foo', $data->getValue()); // yep, value is file name |
||
66 | $this->assertEquals('uff', $data->getTempName()); |
||
67 | $this->assertEquals('octet', $data->getMimeType()); |
||
68 | $this->assertEquals(15, $data->getError()); |
||
69 | $this->assertEquals(20, $data->getSize()); |
||
70 | } |
||
71 | } |
||
72 |
This check looks for function or method calls that always return null and whose return value is used.
The method
getObject()
can return nothing but null, so it makes no sense to use the return value.The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.