‪TYPO3CMS  ‪main
UserRecycleTest.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
20 use PHPUnit\Framework\Attributes\Test;
23 
25 {
26  protected function ‪setUp(): void
27  {
28  parent::setUp();
29  $this->importCSVDataSet(__DIR__ . '/../../Fixtures/Database/pages.csv');
30  $this->importCSVDataSet(__DIR__ . '/../../Fixtures/Database/be_groups.csv');
31  $this->importCSVDataSet(__DIR__ . '/../../Fixtures/Database/be_users.csv');
32  // Set up "editor" user
33  $backendUser = $this->setUpBackendUser(2);
34  ‪$GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser);
35  }
36 
37  #[Test]
38  public function ‪retrieveDeletedPagesNoRecursion(): void
39  {
40  $deletedPages = $this->‪getDeletedPages(1, 0);
41  self::assertCount(1, $deletedPages);
42  self::assertArrayHasKey('pages', $deletedPages);
43  self::assertCount(2, $deletedPages['pages']);
44  self::assertGreaterThan(0, (int)($deletedPages['pages'][0]['uid'] ?? 0));
45  self::assertSame(3, (int)$deletedPages['pages'][0]['uid']);
46  }
47 
48  #[Test]
50  {
51  $deletedPages = $this->‪getDeletedPages(1, 1);
52  self::assertCount(1, $deletedPages);
53  self::assertArrayHasKey('pages', $deletedPages);
54  self::assertCount(3, $deletedPages['pages']);
55  self::assertGreaterThan(0, (int)($deletedPages['pages'][0]['uid'] ?? 0));
56  self::assertSame(3, (int)$deletedPages['pages'][0]['uid']);
57  }
58 
59  #[Test]
61  {
62  $deletedPages = $this->‪getDeletedPages(6, 0);
63  self::assertCount(0, $deletedPages);
64  }
65 
66  #[Test]
67  public function ‪canNotRetrieveDeletedWithNoAccess(): void
68  {
69  $deletedPages = $this->‪getDeletedPages(7, 0);
70  self::assertCount(0, $deletedPages);
71  }
72 }
‪TYPO3\CMS\Core\Localization\LanguageServiceFactory
Definition: LanguageServiceFactory.php:25
‪TYPO3\CMS\Recycler\Tests\Functional\Recycle\Pages\UserRecycleTest\canNotRetrieveDeletedPagesOutsideWebmount
‪canNotRetrieveDeletedPagesOutsideWebmount()
Definition: UserRecycleTest.php:60
‪TYPO3\CMS\Recycler\Tests\Functional\Recycle\AbstractRecycleTestCase\getDeletedPages
‪array getDeletedPages($pageUid, $depth=0)
Definition: AbstractRecycleTestCase.php:35
‪TYPO3\CMS\Recycler\Tests\Functional\Recycle\Pages\UserRecycleTest\canNotRetrieveDeletedWithNoAccess
‪canNotRetrieveDeletedWithNoAccess()
Definition: UserRecycleTest.php:67
‪TYPO3\CMS\Recycler\Tests\Functional\Recycle\AbstractRecycleTestCase
Definition: AbstractRecycleTestCase.php:25
‪TYPO3\CMS\Recycler\Tests\Functional\Recycle\Pages\UserRecycleTest
Definition: UserRecycleTest.php:25
‪TYPO3\CMS\Recycler\Tests\Functional\Recycle\Pages
Definition: AdminRecycleTest.php:18
‪TYPO3\CMS\Recycler\Tests\Functional\Recycle\Pages\UserRecycleTest\retrieveDeletedPagesNoRecursion
‪retrieveDeletedPagesNoRecursion()
Definition: UserRecycleTest.php:38
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:25
‪TYPO3\CMS\Recycler\Tests\Functional\Recycle\Pages\UserRecycleTest\setUp
‪setUp()
Definition: UserRecycleTest.php:26
‪TYPO3\CMS\Recycler\Tests\Functional\Recycle\Pages\UserRecycleTest\retrieveDeletedPagesOneLevelRecursion
‪retrieveDeletedPagesOneLevelRecursion()
Definition: UserRecycleTest.php:49