forked from Freemius/freemius-php-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGetLicenseData.php
More file actions
39 lines (34 loc) · 1.16 KB
/
GetLicenseData.php
File metadata and controls
39 lines (34 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
/**
* How to set up and run tests:
*
* 1. Install dependencies via Composer:
* composer install
*
* 2. Copy the `credentials.example.php` file to `credentials.php` and fill in your actual credentials:
* cp tests/credentials.example.php tests/credentials.php
* // Then edit `tests/credentials.php` to include your actual API credentials.
*
* 3. Run the tests using PHPUnit:
* vendor/bin/phpunit
*/
use PHPUnit\Framework\TestCase;
class GetLicenseData extends TestCase
{
public function testLicenseData()
{
$api = new Freemius_Api(
FS__API_SCOPE,
FS__API_ENTITY_ID,
FS__API_PUBLIC_KEY,
FS__API_SECRET_KEY
);
$license_key = FS__TEST_VALID_LICENSE_KEY;
$result = $api->Api("/licenses.json", "GET", array(
'search' => ($license_key),
));
$this->assertIsArray($result->licenses, 'Licenses should be an array');
$this->assertCount(1, $result->licenses, 'There should be exactly one license');
$this->assertEquals($license_key, $result->licenses[0]->secret_key, 'The secret key should match the provided license key');
}
}