This repository has been archived on 2026-04-06. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
PayPal-PHP-SDK/tests/PayPal/Test/Common/UserAgentTest.php

29 lines
924 B
PHP

<?php
use PayPal\Common\PayPalUserAgent;
use PHPUnit\Framework\TestCase;
class UserAgentTest extends TestCase
{
public function testGetValue()
{
$ua = PayPalUserAgent::getValue("name", "version");
list($id, $version, $features) = sscanf($ua, "PayPalSDK/%s %s (%[^[]])");
// Check that we pass the useragent in the expected format
$this->assertNotNull($id);
$this->assertNotNull($version);
$this->assertNotNull($features);
$this->assertEquals("name", $id);
$this->assertEquals("version", $version);
// Check that we pass in these mininal features
$this->assertThat($features, $this->stringContains("os="));
$this->assertThat($features, $this->stringContains("bit="));
$this->assertThat($features, $this->stringContains("platform-ver="));
$this->assertGreaterThan(5, count(explode(';', $features)));
}
}