TYPO3 CMS  TYPO3_7-6
DatabaseUniqueUidNewRowTest.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
19 
24 {
28  protected $subject;
29 
30  protected function setUp()
31  {
32  $this->subject = new DatabaseUniqueUidNewRow();
33  }
34 
39  {
40  $input = [
41  'command' => 'edit',
42  'databaseRow' => [
43  'uid' => 42,
44  ],
45  ];
46  $this->assertSame($input, $this->subject->addData($input));
47  }
48 
53  {
54  $input = [
55  'command' => 'new',
56  'databaseRow' => [
57  'uid' => 42,
58  ],
59  ];
60 
61  $this->setExpectedException(\InvalidArgumentException::class, $this->anything(), 1437991120);
62 
63  $this->subject->addData($input);
64  }
65 
69  public function addDataSetsUniqeId()
70  {
71  $input = [
72  'command' => 'new',
73  'databaseRow' => [],
74  ];
75  $result = $this->subject->addData($input);
76  $result = substr($result['databaseRow']['uid'], 0, 3);
77  $this->assertSame('NEW', $result);
78  }
79 }