Repository navigation
Expand file tree
/
Copy pathInputDataFactoryTest.php
More file actions
56 lines (44 loc) · 1.47 KB
/
Copy pathInputDataFactoryTest.php
File metadata and controls
56 lines (44 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
declare(strict_types=1);
/**
* This file is part of CodeIgniter 4 framework.
*
* (c) CodeIgniter Foundation <admin@codeigniter.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace CodeIgniter\Input;
use CodeIgniter\Test\CIUnitTestCase;
use PHPUnit\Framework\Attributes\Group;
/**
* @internal
*/
#[Group('Others')]
final class InputDataFactoryTest extends CIUnitTestCase
{
public function testCreateReturnsInputData(): void
{
$factory = new InputDataFactory();
$input = $factory->create(['page' => '2']);
$this->assertInstanceOf(InputData::class, $input);
$this->assertSame(2, $input->integer('page'));
}
public function testCreateReturnsNewInputDataInstances(): void
{
$factory = new InputDataFactory();
$this->assertNotSame($factory->create([]), $factory->create([]));
}
public function testCreateValidatedReturnsValidatedInput(): void
{
$factory = new InputDataFactory();
$input = $factory->createValidated(['page' => '2']);
$this->assertInstanceOf(ValidatedInput::class, $input);
$this->assertSame(2, $input->integer('page'));
}
public function testCreateValidatedReturnsNewValidatedInputInstances(): void
{
$factory = new InputDataFactory();
$this->assertNotSame($factory->createValidated([]), $factory->createValidated([]));
}
}