-
Notifications
You must be signed in to change notification settings - Fork 224
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes #6152: Add license type to what is reported to Mixpanel
Adds the license type to data sent to Mixpanel.
- Loading branch information
Gael Robin
committed
Sep 27, 2023
1 parent
539ecea
commit 9917482
Showing
5 changed files
with
84 additions
and
19 deletions.
There are no files selected for viewing
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
28 changes: 28 additions & 0 deletions
28
tests/Fixtures/inc/functions/admin/rocketGetLicenseType.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,28 @@ | ||
<?php | ||
|
||
return [ | ||
'singleLicense' => [ | ||
'config' => [ | ||
'customer_data' => (object)['licence_account' => 1], | ||
], | ||
'expected' => 'Single', | ||
], | ||
'infiniteLicense' => [ | ||
'config' => [ | ||
'customer_data' => (object)['licence_account' => -1], | ||
], | ||
'expected' => 'Infinite', | ||
], | ||
'plusLicense' => [ | ||
'config' => [ | ||
'customer_data' => (object)['licence_account' => 3], | ||
], | ||
'expected' => 'Plus', | ||
], | ||
'unavailableLicense' => [ | ||
'config' => [ | ||
'customer_data' => null, | ||
], | ||
'expected' => 'Unavailable', | ||
], | ||
]; |
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,24 @@ | ||
<?php | ||
|
||
namespace WP_Rocket\Tests\Unit\inc\functions\admin; | ||
|
||
use WP_Rocket\Tests\Unit\TestCase; | ||
|
||
class Test_RocketGetLicenseType extends TestCase { | ||
|
||
public function setUp(): void { | ||
parent::setUp(); | ||
} | ||
|
||
/** | ||
* @dataProvider configTestData | ||
*/ | ||
public function testReturnAsExpected($config, $expected) { | ||
$this->stubTranslationFunctions(); | ||
// Extract 'customer_data' from the config | ||
$customer_data = $config['customer_data']; | ||
$result = rocket_get_license_type($customer_data); | ||
|
||
$this->assertEquals($expected, $result); | ||
} | ||
} |