|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Jalle19\StatusManager\Test\Database; |
|
4
|
|
|
|
|
5
|
|
|
use Jalle19\StatusManager\Database\Subscription; |
|
6
|
|
|
use Jalle19\tvheadend\model\multiplex\Multiplex; |
|
7
|
|
|
use Jalle19\tvheadend\model\network\DvbcNetwork; |
|
8
|
|
|
use Jalle19\tvheadend\model\network\DvbsNetwork; |
|
9
|
|
|
use Jalle19\tvheadend\model\SubscriptionStatus; |
|
10
|
|
|
use PHPUnit\Framework\TestCase; |
|
11
|
|
|
|
|
12
|
|
|
class SubscriptionTest extends TestCase |
|
13
|
|
|
{ |
|
14
|
|
|
|
|
15
|
|
|
public function testParseNetworkAndMux(): void |
|
16
|
|
|
{ |
|
17
|
|
|
$availableNetworks = [ |
|
18
|
|
|
new DvbsNetwork('0.8W Thor'), |
|
19
|
|
|
new DvbsNetwork('0.8W Thor 5/6/7 Intelsat 10-02'), |
|
20
|
|
|
new DvbsNetwork('28.2E Astra'), |
|
21
|
|
|
new DvbcNetwork('DNA'), |
|
22
|
|
|
]; |
|
23
|
|
|
|
|
24
|
|
|
$availableMuxes = [ |
|
25
|
|
|
new Multiplex('226MHz'), |
|
26
|
|
|
new Multiplex('234MHz'), |
|
27
|
|
|
new Multiplex('12437H'), |
|
28
|
|
|
new Multiplex('12437V'), |
|
29
|
|
|
new Multiplex('242MHz'), |
|
30
|
|
|
]; |
|
31
|
|
|
|
|
32
|
|
|
// Network name |
|
33
|
|
|
$subscriptionStatus = new SubscriptionStatus(); |
|
34
|
|
|
$subscriptionStatus->channel = 'TV8 HD'; |
|
35
|
|
|
$subscriptionStatus->service = 'SAT>IP DVB-S Tuner #1 (10.110.5.11:9983@TCP)/0.8W Thor/12437H/TV8 HD'; |
|
36
|
|
|
$this->assertEquals('0.8W Thor', Subscription::parseNetwork($subscriptionStatus, $availableNetworks)); |
|
37
|
|
|
$this->assertEquals('12437H', Subscription::parseMux($subscriptionStatus, $availableMuxes)); |
|
38
|
|
|
|
|
39
|
|
|
// Trickier network name |
|
40
|
|
|
$subscriptionStatus->service = 'SAT>IP DVB-S Tuner #1 (10.110.5.11:9983@TCP)/0.8W Thor 5/6/7 Intelsat 10-02/12437H/TV8 HD'; |
|
41
|
|
|
$this->assertEquals('0.8W Thor 5/6/7 Intelsat 10-02', |
|
42
|
|
|
Subscription::parseNetwork($subscriptionStatus, $availableNetworks)); |
|
43
|
|
|
|
|
44
|
|
|
// Tricky adapter name |
|
45
|
|
|
$subscriptionStatus->channel = 'MTV3 HD'; |
|
46
|
|
|
$subscriptionStatus->service = 'TurboSight TBS 6281 DVB-T/T2/C #1 : DVB-C #0/DNA/226MHz/MTV3 HD'; |
|
47
|
|
|
$this->assertEquals('DNA', Subscription::parseNetwork($subscriptionStatus, $availableNetworks)); |
|
48
|
|
|
$this->assertEquals('226MHz', Subscription::parseMux($subscriptionStatus, $availableMuxes)); |
|
49
|
|
|
} |
|
50
|
|
|
} |
|
51
|
|
|
|