Skip to content

Commit be9b982

Browse files
committed
Revert "OXDEV-8213 Added function for equals and beginsWith comparison"
This reverts commit 5a8179a.
1 parent c5702ba commit be9b982

2 files changed

Lines changed: 0 additions & 48 deletions

File tree

src/DataType/Filter/StringFilter.php

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -42,23 +42,6 @@ public function contains(): ?string
4242
return $this->contains;
4343
}
4444

45-
public function matches(string $value): bool
46-
{
47-
if ($this->contains !== null && !str_contains($value, $this->contains)) {
48-
return false;
49-
}
50-
51-
if ($this->equals !== null && $value !== $this->equals) {
52-
return false;
53-
}
54-
55-
if ($this->beginsWith !== null && !str_starts_with($value, $this->beginsWith)) {
56-
return false;
57-
}
58-
59-
return true;
60-
}
61-
6245
public function beginsWith(): ?string
6346
{
6447
return $this->beginsWith;

tests/Unit/DataType/Filter/StringFilterTest.php

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -144,35 +144,4 @@ public function testAddQueryPartWithAlias(): void
144144

145145
$this->assertEquals('db_table_alias.DB_FIELD = :db_field_eq', (string)$where);
146146
}
147-
148-
/** @dataProvider matchesDataProvider */
149-
public function testMatches(
150-
string $stringForTrueCase,
151-
string $stringForFalseCase,
152-
StringFilter $initFilter
153-
): void {
154-
$this->assertTrue($initFilter->matches($stringForTrueCase));
155-
$this->assertFalse($initFilter->matches($stringForFalseCase));
156-
}
157-
158-
public static function matchesDataProvider(): \Generator
159-
{
160-
yield "test match equals" => [
161-
'stringForTrueCase' => 'test theme 1',
162-
'stringForFalseCase' => 'test theme 22',
163-
'initFilter' => new StringFilter(equals: 'test theme 1')
164-
];
165-
166-
yield "test match contains" => [
167-
'stringForTrueCase' => 'test abc theme',
168-
'stringForFalseCase' => 'test xyz theme',
169-
'initFilter' => new StringFilter(contains: 'abc')
170-
];
171-
172-
yield "test match begins with " => [
173-
'stringForTrueCase' => 'this start',
174-
'stringForFalseCase' => 'this deos not start with',
175-
'initFilter' => new StringFilter(beginsWith: 'this start')
176-
];
177-
}
178147
}

0 commit comments

Comments
 (0)