Skip to content

Commit

Permalink
test: add dto tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sitepark-veltrup committed Feb 22, 2024
1 parent 8856dac commit e05ba48
Show file tree
Hide file tree
Showing 49 changed files with 660 additions and 9 deletions.
3 changes: 2 additions & 1 deletion phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
cacheResultFile="var/cache/.phpunit.result.cache"
cacheDirectory="var/cache/.phpunit.cache">

<coverage>
<coverage
disableCodeCoverageIgnore="false">
<report>
<clover outputFile="var/log/clover/clover.xml"/>
<html outputDirectory="var/log/clover"/>
Expand Down
3 changes: 3 additions & 0 deletions src/Dto/Indexer/IndexerStatusState.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

namespace Atoolo\Search\Dto\Indexer;

/**
* @codeCoverageIgnore
*/
enum IndexerStatusState: string
{
case UNKNOWN = 'UNKNOWN';
Expand Down
3 changes: 3 additions & 0 deletions src/Dto/Search/Query/Facet/CategoryFacet.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

namespace Atoolo\Search\Dto\Search\Query\Facet;

/**
* @codeCoverageIgnore
*/
class CategoryFacet extends FacetField
{
/**
Expand Down
3 changes: 3 additions & 0 deletions src/Dto/Search/Query/Facet/ContentSectionTypeFacet.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

namespace Atoolo\Search\Dto\Search\Query\Facet;

/**
* @codeCoverageIgnore
*/
class ContentSectionTypeFacet extends FacetField
{
/**
Expand Down
3 changes: 3 additions & 0 deletions src/Dto/Search/Query/Facet/Facet.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

namespace Atoolo\Search\Dto\Search\Query\Facet;

/**
* @codeCoverageIgnore
*/
abstract class Facet
{
public function __construct(
Expand Down
3 changes: 3 additions & 0 deletions src/Dto/Search/Query/Facet/FacetField.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

namespace Atoolo\Search\Dto\Search\Query\Facet;

/**
* @codeCoverageIgnore
*/
class FacetField extends Facet
{
/**
Expand Down
3 changes: 3 additions & 0 deletions src/Dto/Search/Query/Facet/FacetMultiQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

namespace Atoolo\Search\Dto\Search\Query\Facet;

/**
* @codeCoverageIgnore
*/
class FacetMultiQuery extends Facet
{
/**
Expand Down
3 changes: 3 additions & 0 deletions src/Dto/Search/Query/Facet/FacetQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

namespace Atoolo\Search\Dto\Search\Query\Facet;

/**
* @codeCoverageIgnore
*/
class FacetQuery extends Facet
{
public function __construct(
Expand Down
3 changes: 3 additions & 0 deletions src/Dto/Search/Query/Facet/GroupFacet.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

namespace Atoolo\Search\Dto\Search\Query\Facet;

/**
* @codeCoverageIgnore
*/
class GroupFacet extends FacetField
{
/**
Expand Down
3 changes: 3 additions & 0 deletions src/Dto/Search/Query/Facet/ObjectTypeFacet.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

namespace Atoolo\Search\Dto\Search\Query\Facet;

/**
* @codeCoverageIgnore
*/
class ObjectTypeFacet extends FacetField
{
/**
Expand Down
3 changes: 3 additions & 0 deletions src/Dto/Search/Query/Facet/SiteFacet.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

namespace Atoolo\Search\Dto\Search\Query\Facet;

/**
* @codeCoverageIgnore
*/
class SiteFacet extends FacetField
{
/**
Expand Down
3 changes: 3 additions & 0 deletions src/Dto/Search/Query/Filter/CategoryFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

namespace Atoolo\Search\Dto\Search\Query\Filter;

/**
* @codeCoverageIgnore
*/
class CategoryFilter extends FieldFilter
{
public function __construct(
Expand Down
3 changes: 3 additions & 0 deletions src/Dto/Search/Query/Filter/ContentSectionTypeFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

namespace Atoolo\Search\Dto\Search\Query\Filter;

/**
* @codeCoverageIgnore
*/
class ContentSectionTypeFilter extends FieldFilter
{
public function __construct(
Expand Down
4 changes: 3 additions & 1 deletion src/Dto/Search/Query/Filter/FieldFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

namespace Atoolo\Search\Dto\Search\Query\Filter;

use InvalidArgumentException;

class FieldFilter extends Filter
{
/**
Expand All @@ -17,7 +19,7 @@ public function __construct(
string ...$values
) {
if (count($values) === 0) {
throw new \InvalidArgumentException(
throw new InvalidArgumentException(
'values is an empty array'
);
}
Expand Down
3 changes: 3 additions & 0 deletions src/Dto/Search/Query/Filter/Filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

namespace Atoolo\Search\Dto\Search\Query\Filter;

/**
* @codeCoverageIgnore
*/
abstract class Filter
{
/**
Expand Down
3 changes: 3 additions & 0 deletions src/Dto/Search/Query/Filter/GroupFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

namespace Atoolo\Search\Dto\Search\Query\Filter;

/**
* @codeCoverageIgnore
*/
class GroupFilter extends FieldFilter
{
public function __construct(
Expand Down
3 changes: 3 additions & 0 deletions src/Dto/Search/Query/Filter/ObjectTypeFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

namespace Atoolo\Search\Dto\Search\Query\Filter;

/**
* @codeCoverageIgnore
*/
class ObjectTypeFilter extends FieldFilter
{
public function __construct(
Expand Down
3 changes: 3 additions & 0 deletions src/Dto/Search/Query/Filter/SiteFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

namespace Atoolo\Search\Dto\Search\Query\Filter;

/**
* @codeCoverageIgnore
*/
class SiteFilter extends FieldFilter
{
public function __construct(
Expand Down
2 changes: 2 additions & 0 deletions src/Dto/Search/Query/MoreLikeThisQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
* properties of the reference document, such as keywords or structure,
* to identify other documents with similar characteristics in the
* database or search index.
*
* @codeCoverageIgnore
*/
class MoreLikeThisQuery
{
Expand Down
3 changes: 3 additions & 0 deletions src/Dto/Search/Query/QueryDefaultOperator.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

namespace Atoolo\Search\Dto\Search\Query;

/**
* @codeCoverageIgnore
*/
enum QueryDefaultOperator: string
{
case AND = 'AND';
Expand Down
3 changes: 3 additions & 0 deletions src/Dto/Search/Query/SelectQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
use Atoolo\Search\Dto\Search\Query\Filter\Filter;
use Atoolo\Search\Dto\Search\Query\Sort\Criteria;

/**
* @codeCoverageIgnore
*/
class SelectQuery
{
/**
Expand Down
4 changes: 2 additions & 2 deletions src/Dto/Search/Query/SelectQueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ public function build(): SelectQuery
$this->offset,
$this->limit,
$this->sort,
$this->filter,
$this->facets,
array_values($this->filter),
array_values($this->facets),
$this->queryDefaultOperator
);
}
Expand Down
3 changes: 3 additions & 0 deletions src/Dto/Search/Query/Sort/Criteria.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

namespace Atoolo\Search\Dto\Search\Query\Sort;

/**
* @codeCoverageIgnore
*/
abstract class Criteria
{
public function __construct(
Expand Down
3 changes: 3 additions & 0 deletions src/Dto/Search/Query/Sort/Date.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

namespace Atoolo\Search\Dto\Search\Query\Sort;

/**
* @codeCoverageIgnore
*/
class Date extends Criteria
{
}
3 changes: 3 additions & 0 deletions src/Dto/Search/Query/Sort/Direction.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

namespace Atoolo\Search\Dto\Search\Query\Sort;

/**
* @codeCoverageIgnore
*/
enum Direction
{
case ASC;
Expand Down
3 changes: 3 additions & 0 deletions src/Dto/Search/Query/Sort/Headline.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

namespace Atoolo\Search\Dto\Search\Query\Sort;

/**
* @codeCoverageIgnore
*/
class Headline extends Criteria
{
}
5 changes: 3 additions & 2 deletions src/Dto/Search/Query/Sort/Name.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@

namespace Atoolo\Search\Dto\Search\Query\Sort;

use Atoolo\Search\Dto\Search\Query\Sort\Criteria;

/**
* @codeCoverageIgnore
*/
class Name extends Criteria
{
}
3 changes: 3 additions & 0 deletions src/Dto/Search/Query/Sort/Natural.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

namespace Atoolo\Search\Dto\Search\Query\Sort;

/**
* @codeCoverageIgnore
*/
class Natural extends Criteria
{
}
3 changes: 3 additions & 0 deletions src/Dto/Search/Query/Sort/Score.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

namespace Atoolo\Search\Dto\Search\Query\Sort;

/**
* @codeCoverageIgnore
*/
class Score extends Criteria
{
}
2 changes: 2 additions & 0 deletions src/Dto/Search/Query/SuggestQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
* In the search context, "Suggest" refers to a feature that automatically
* makes suggestions as the user enters a search query to speed up and
* simplify the search process.
*
* @codeCoverageIgnore
*/
class SuggestQuery
{
Expand Down
3 changes: 3 additions & 0 deletions src/Dto/Search/Result/Facet.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

namespace Atoolo\Search\Dto\Search\Result;

/**
* @codeCoverageIgnore
*/
class Facet
{
public function __construct(
Expand Down
3 changes: 3 additions & 0 deletions src/Dto/Search/Result/FacetGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

namespace Atoolo\Search\Dto\Search\Result;

/**
* @codeCoverageIgnore
*/
class FacetGroup
{
/**
Expand Down
1 change: 1 addition & 0 deletions src/Dto/Search/Result/SearchResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

/**
* @implements IteratorAggregate<Resource>
* @codeCoverageIgnore
*/
class SearchResult implements IteratorAggregate
{
Expand Down
1 change: 1 addition & 0 deletions src/Dto/Search/Result/SuggestResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

/**
* @implements IteratorAggregate<int,Suggestion>
@codeCoverageIgnore
*/
class SuggestResult implements IteratorAggregate
{
Expand Down
3 changes: 3 additions & 0 deletions src/Dto/Search/Result/Suggestion.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

namespace Atoolo\Search\Dto\Search\Result;

/**
* @codeCoverageIgnore
*/
class Suggestion
{
public function __construct(
Expand Down
2 changes: 2 additions & 0 deletions test/Dto/Indexer/IndexerParameterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@

use Atoolo\Search\Dto\Indexer\IndexerParameter;
use InvalidArgumentException;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;

#[CoversClass(IndexerParameter::class)]
class IndexerParameterTest extends TestCase
{
public function testToLowerChunkSize(): void
Expand Down
Loading

0 comments on commit e05ba48

Please sign in to comment.