-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TASK] Add sort order configuration to plugin
Related: #79
- Loading branch information
Showing
16 changed files
with
540 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
Tests/Functional/Fixtures/tx_contacts_domain_model_contact.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<dataset> | ||
<tx_contacts_domain_model_contact> | ||
<uid>1</uid> | ||
<pid>2</pid> | ||
<first_name>Max</first_name> | ||
<last_name>Mustermann</last_name> | ||
<teaser>''</teaser> | ||
<description>''</description> | ||
<meta_description>''</meta_description> | ||
</tx_contacts_domain_model_contact> | ||
<tx_contacts_domain_model_contact> | ||
<uid>2</uid> | ||
<pid>2</pid> | ||
<first_name>Erika</first_name> | ||
<last_name>Mustermann</last_name> | ||
<teaser>''</teaser> | ||
<description>''</description> | ||
<meta_description>''</meta_description> | ||
</tx_contacts_domain_model_contact> | ||
|
||
<tx_contacts_domain_model_contact> | ||
<uid>3</uid> | ||
<pid>3</pid> | ||
<first_name>John</first_name> | ||
<last_name>Doe</last_name> | ||
<teaser>''</teaser> | ||
<description>''</description> | ||
<meta_description>''</meta_description> | ||
</tx_contacts_domain_model_contact> | ||
<tx_contacts_domain_model_contact> | ||
<uid>4</uid> | ||
<pid>3</pid> | ||
<first_name>Jane</first_name> | ||
<last_name>Doe</last_name> | ||
<teaser>''</teaser> | ||
<description>''</description> | ||
<meta_description>''</meta_description> | ||
</tx_contacts_domain_model_contact> | ||
|
||
<tx_contacts_domain_model_contact> | ||
<uid>5</uid> | ||
<pid>4</pid> | ||
<first_name>Jean</first_name> | ||
<last_name>Dupont</last_name> | ||
<teaser>''</teaser> | ||
<description>''</description> | ||
<meta_description>''</meta_description> | ||
</tx_contacts_domain_model_contact> | ||
<tx_contacts_domain_model_contact> | ||
<uid>6</uid> | ||
<pid>4</pid> | ||
<first_name>Matti</first_name> | ||
<last_name>Meikäläinen</last_name> | ||
<teaser>''</teaser> | ||
<description>''</description> | ||
<meta_description>''</meta_description> | ||
</tx_contacts_domain_model_contact> | ||
<tx_contacts_domain_model_contact> | ||
<uid>7</uid> | ||
<pid>4</pid> | ||
<first_name>Mario</first_name> | ||
<last_name>Rossi</last_name> | ||
<teaser>''</teaser> | ||
<description>''</description> | ||
<meta_description>''</meta_description> | ||
</tx_contacts_domain_model_contact> | ||
<tx_contacts_domain_model_contact> | ||
<uid>8</uid> | ||
<pid>4</pid> | ||
<first_name>Jan</first_name> | ||
<last_name>Janssen</last_name> | ||
<teaser>''</teaser> | ||
<description>''</description> | ||
<meta_description>''</meta_description> | ||
</tx_contacts_domain_model_contact> | ||
</dataset> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
<?php | ||
|
||
namespace Extcode\Contacts\Tests\Functional\Repository; | ||
|
||
/* | ||
* This file is part of the package extcode/contacts. | ||
* | ||
* For the full copyright and license information, please read the | ||
* LICENSE file that was distributed with this source code. | ||
*/ | ||
|
||
use Extcode\Contacts\Domain\Model\Dto\Demand; | ||
use Extcode\Contacts\Domain\Repository\CompanyRepository; | ||
use TYPO3\CMS\Core\Utility\GeneralUtility; | ||
use TYPO3\CMS\Extbase\Object\ObjectManager; | ||
use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; | ||
|
||
class CompanyRepositoryTest extends FunctionalTestCase | ||
{ | ||
|
||
/** | ||
* @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface | ||
*/ | ||
protected $objectManager; | ||
|
||
/** | ||
* @var CompanyRepository | ||
*/ | ||
protected $companyRepository; | ||
|
||
protected $testExtensionsToLoad = [ | ||
'typo3conf/ext/contacts' | ||
]; | ||
|
||
public function setUp(): void | ||
{ | ||
parent::setUp(); | ||
$this->objectManager = GeneralUtility::makeInstance(ObjectManager::class); | ||
$this->companyRepository = $this->objectManager->get(CompanyRepository::class); | ||
|
||
$this->importDataSet(__DIR__ . '/../Fixtures/pages.xml'); | ||
$this->importDataSet(__DIR__ . '/../Fixtures/tx_contacts_domain_model_company.xml'); | ||
} | ||
|
||
public function tearDown(): void | ||
{ | ||
unset($this->companyRepository); | ||
unset($this->objectManager); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function findDemandedAndOrderByName(): void | ||
{ | ||
$demand = new Demand(); | ||
$demand->setOrderBy('name'); | ||
|
||
$querySettings = $this->companyRepository->createQuery()->getQuerySettings(); | ||
$querySettings->setRespectStoragePage(false); | ||
$this->companyRepository->setDefaultQuerySettings($querySettings); | ||
$companies = $this->companyRepository->findDemanded($demand)->toArray(); | ||
|
||
$this->assertSame( | ||
'Abgeordnetenhaus von Berlin', | ||
$companies[0]->getName() | ||
); | ||
$this->assertSame( | ||
'Bayerischer Landtag', | ||
$companies[1]->getName() | ||
); | ||
$this->assertSame( | ||
'Bremische Bürgerschaft', | ||
$companies[2]->getName() | ||
); | ||
$this->assertSame( | ||
'Landtag von Baden-Württemberg', | ||
$companies[10]->getName() | ||
); | ||
$this->assertSame( | ||
'Thüringer Landtag', | ||
$companies[15]->getName() | ||
); | ||
} | ||
} |
Oops, something went wrong.