-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
545 additions
and
137 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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,38 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
namespace In2code\Lux\Events; | ||
|
||
final class ReadableReferrersEvent | ||
{ | ||
protected string $referrer; | ||
protected array $sources; | ||
|
||
public function __construct(string $referrer, array $sources) | ||
{ | ||
$this->referrer = $referrer; | ||
$this->sources = $sources; | ||
} | ||
|
||
public function getReferrer(): string | ||
{ | ||
return $this->referrer; | ||
} | ||
|
||
public function setReferrer(string $referrer): self | ||
{ | ||
$this->referrer = $referrer; | ||
return $this; | ||
} | ||
|
||
public function getSources(): array | ||
{ | ||
return $this->sources; | ||
} | ||
|
||
public function setSources(array $sources): self | ||
{ | ||
$this->sources = $sources; | ||
return $this; | ||
} | ||
} |
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
Large diffs are not rendered by default.
Oops, something went wrong.
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,62 @@ | ||
<?php | ||
|
||
namespace In2code\Lux\Tests\Unit\Domain\Service; | ||
|
||
use In2code\Lux\Tests\Unit\Fixtures\Domain\Service\Referrer\ReadableFixture; | ||
use TYPO3\TestingFramework\Core\Unit\UnitTestCase; | ||
|
||
/** | ||
* @coversDefaultClass \In2code\Lux\Domain\Service\Referrer\Readable | ||
*/ | ||
class ReadableTest extends UnitTestCase | ||
{ | ||
public static function getReadableReferrerDataProvider(): array | ||
{ | ||
return [ | ||
[ | ||
'https://www.google.com', // Referrer URL | ||
'Google Organic', // Readable name | ||
], | ||
[ | ||
'https://t.co/anything/new', | ||
'X (Twitter)', | ||
], | ||
[ | ||
'https://syndicatedsearch.goog/abc12345', | ||
'Google AdSense', | ||
], | ||
[ | ||
'https://ads.microsoft.com/', | ||
'Microsoft Advertising', | ||
], | ||
[ | ||
'https://stackoverflow.com/questions/75556288/typo3-lux-newsletter', | ||
'Stack Overflow', | ||
], | ||
]; | ||
} | ||
|
||
/** | ||
* @param string $referrer | ||
* @param string $expectedResult | ||
* @return void | ||
* @dataProvider getReadableReferrerDataProvider | ||
* @covers ::getReadableReferrer | ||
* @covers ::getDomain | ||
*/ | ||
public function testGetReadableReferrer(string $referrer, string $expectedResult): void | ||
{ | ||
$readable = new ReadableFixture($referrer); | ||
self::assertSame($expectedResult, $readable->getReadableReferrer()); | ||
} | ||
|
||
/** | ||
* @return void | ||
* @covers ::getOriginalReferrer | ||
*/ | ||
public function testGetOriginalReferrer(): void | ||
{ | ||
$readable = new ReadableFixture(''); | ||
self::assertGreaterThan($readable->getOriginalReferrer(), 10); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
Tests/Unit/Fixtures/Domain/Service/Referrer/ReadableFixture.php
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,13 @@ | ||
<?php | ||
|
||
namespace In2code\Lux\Tests\Unit\Fixtures\Domain\Service\Referrer; | ||
|
||
use In2code\Lux\Domain\Service\Referrer\Readable; | ||
|
||
class ReadableFixture extends Readable | ||
{ | ||
public function __construct(string $referrer = '') | ||
{ | ||
$this->referrer = $referrer; | ||
} | ||
} |
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 |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
'description' => 'Living User Experience - LUX - the Marketing Automation tool for TYPO3. | ||
Turn your visitors to leads. Identification and profiling of your visitors within your TYPO3 website.', | ||
'category' => 'plugin', | ||
'version' => '35.7.0', | ||
'version' => '35.8.0', | ||
'author' => 'Alex Kellner', | ||
'author_email' => '[email protected]', | ||
'author_company' => 'in2code.de', | ||
|