mirror of
https://github.com/FriendsOfTYPO3/tea.git
synced 2024-11-22 12:56:12 +01:00
[FEATURE] Add default sorting by title to the TeaRepository (#14)
This commit is contained in:
parent
2efde32056
commit
9b10334c0d
4 changed files with 25 additions and 0 deletions
|
@ -3,6 +3,7 @@ declare(strict_types = 1);
|
||||||
namespace OliverKlee\Tea\Domain\Repository\Product;
|
namespace OliverKlee\Tea\Domain\Repository\Product;
|
||||||
|
|
||||||
use OliverKlee\Tea\Domain\Repository\Traits\StoragePageAgnosticTrait;
|
use OliverKlee\Tea\Domain\Repository\Traits\StoragePageAgnosticTrait;
|
||||||
|
use TYPO3\CMS\Extbase\Persistence\QueryInterface;
|
||||||
use TYPO3\CMS\Extbase\Persistence\Repository;
|
use TYPO3\CMS\Extbase\Persistence\Repository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -13,4 +14,9 @@ use TYPO3\CMS\Extbase\Persistence\Repository;
|
||||||
class TeaRepository extends Repository
|
class TeaRepository extends Repository
|
||||||
{
|
{
|
||||||
use StoragePageAgnosticTrait;
|
use StoragePageAgnosticTrait;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string[]
|
||||||
|
*/
|
||||||
|
protected $defaultOrderings = ['title' => QueryInterface::ORDER_ASCENDING];
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,4 +6,10 @@
|
||||||
<title>Earl Grey</title>
|
<title>Earl Grey</title>
|
||||||
<description>Fresh and hot.</description>
|
<description>Fresh and hot.</description>
|
||||||
</tx_tea_domain_model_product_tea>
|
</tx_tea_domain_model_product_tea>
|
||||||
|
<tx_tea_domain_model_product_tea>
|
||||||
|
<uid>2</uid>
|
||||||
|
<pid>1</pid>
|
||||||
|
<title>Assam</title>
|
||||||
|
<description>Dark ans strong.</description>
|
||||||
|
</tx_tea_domain_model_product_tea>
|
||||||
</dataset>
|
</dataset>
|
||||||
|
|
|
@ -56,6 +56,19 @@ class TeaRepositoryTest extends FunctionalTestCase
|
||||||
static::assertGreaterThanOrEqual(1, \count($container));
|
static::assertGreaterThanOrEqual(1, \count($container));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function findAllSortsByTitleInAscendingOrder()
|
||||||
|
{
|
||||||
|
$this->importDataSet(__DIR__ . '/../Fixtures/Product/Tea.xml');
|
||||||
|
|
||||||
|
$container = $this->subject->findAll();
|
||||||
|
|
||||||
|
$container->rewind();
|
||||||
|
static::assertSame(2, $container->current()->getUid());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue