Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/phpcsfixer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ jobs:
fail-fast: false
matrix:
php_versions: [
'8.3',
'8.5',
]
name: PHP ${{ matrix.php_versions }}
runs-on: ubuntu-latest
steps:
- name: checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: install php ${{ matrix.php_versions }} with extensions
uses: shivammathur/setup-php@v2
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ jobs:
fail-fast: false
matrix:
php_versions: [
'8.1',
'8.2',
'8.3',
'8.4',
'8.5',
]
name: PHP ${{ matrix.php_versions }}
runs-on: ubuntu-latest
steps:
- name: checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: install php ${{ matrix.php_versions }} with extensions
uses: shivammathur/setup-php@v2
Expand Down
18 changes: 11 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Modern use-at-will framework that provides individual components to manage TeamSpeak 3 Server instances",
"keywords": ["ts3", "teamspeak","server","query","filetransfer","management","interface","api"],
"homepage": "https://www.planetteamspeak.com",
"license": "GPL-3.0",
"license": "MIT",
"authors": [
{
"name": "Sven 'ScP' Paulsen",
Expand All @@ -17,24 +17,28 @@
"docs": "https://docs.planetteamspeak.com/ts3/php/framework"
},
"config": {
"sort-packages": true
"sort-packages": true,
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
},
"require": {
"php": ">=8.1",
"php": ">=8.3",
"ext-mbstring": "*",
"ext-json": "*",
"ext-ctype": "*",
"phpseclib/phpseclib": "^3.0",
"phpseclib/phpseclib": "^4.0",
"ext-openssl": "*"
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "^1.1",
"friendsofphp/php-cs-fixer": "^3.8",
"php-coveralls/php-coveralls": "^2.5",
"phpcompatibility/php-compatibility": "^9.3",
"phpunit/phpunit": "^9.5",
"phpunit/phpunit": "^12.5",
"react/socket": "^1.11",
"squizlabs/php_codesniffer": "^3.6",
"symfony/yaml": "^6.0"
"symfony/yaml": "^7.4"
},
"autoload": {
"psr-4": {
Expand All @@ -47,7 +51,7 @@
}
},
"scripts": {
"compatibility": "\"vendor/bin/phpcs\" -ps --basepath=. --standard=PHPCompatibility --runtime-set testVersion 8.0- src",
"compatibility": "\"vendor/bin/phpcs\" -ps --basepath=. --standard=PHPCompatibility --runtime-set testVersion 8.3- src",
"code-style": "\"vendor/bin/php-cs-fixer\" fix --config .php-cs-fixer.php --diff",
"tests": [
"\"vendor/bin/phpunit\" --no-coverage"
Expand Down
33 changes: 17 additions & 16 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,25 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false"
backupStaticAttributes="false"
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
backupGlobals="false"
backupStaticProperties="false"
cacheDirectory=".phpunit.cache"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/12.5/phpunit.xsd"
>
<coverage>
<include>
<directory>./</directory>
</include>
<exclude>
<directory>./images</directory>
<directory>./public</directory>
<directory>./tests</directory>
<directory>./build</directory>
<directory>./vendor</directory>
</exclude>
<report>
<clover outputFile="build/logs/clover.xml"/>
</report>
Expand All @@ -32,4 +21,16 @@
<logging>
<junit outputFile="build/logs/junit.xml"/>
</logging>
<source>
<include>
<directory>./</directory>
</include>
<exclude>
<directory>./images</directory>
<directory>./public</directory>
<directory>./tests</directory>
<directory>./build</directory>
<directory>./vendor</directory>
</exclude>
</source>
</phpunit>
5 changes: 3 additions & 2 deletions src/Helper/Signal.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,14 @@ class Signal
*/
public function emit(string $signal, mixed $params = null): mixed
{
$args = func_get_args();

if (!$this->hasHandlers($signal)) {
return null;
}

if (!is_array($params)) {
$params = func_get_args();
$params = array_slice($params, 1);
$params = array_slice($args, 1);
}

foreach ($this->sigslots[$signal] as $slot) {
Expand Down
16 changes: 5 additions & 11 deletions src/Helper/Uri.php
Original file line number Diff line number Diff line change
Expand Up @@ -340,10 +340,10 @@ public function getHost(mixed $default = null): ?StringHelper
/**
* Returns TRUE if the port is valid.
*
* @param integer|null $port
* @param mixed|null $port
* @return boolean
*/
public function checkPort(int $port = null): bool
public function checkPort(mixed $port = null): bool
{
if ($port === null) {
if ($this->port instanceof StringHelper) {
Expand All @@ -353,15 +353,9 @@ public function checkPort(int $port = null): bool
}
}

switch ($port) {
case str_starts_with($port, '-'):
case $port < 0:
case !is_int($port):
case !filter_var($port, FILTER_VALIDATE_INT, ['options' => ['min_range' => 1, 'max_range' => 65535]]):
return false;
}

return true;
return is_int($port)
&& $port > 0
&& filter_var($port, FILTER_VALIDATE_INT, ['options' => ['min_range' => 1, 'max_range' => 65535]]) !== false;
}

/**
Expand Down
6 changes: 4 additions & 2 deletions src/Node/Host.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,13 @@ public function version(string $ident = null): mixed
*/
public function serverSelect(int $sid, bool $virtual = null): void
{
$getargs = func_get_args();

if ($this->whoami !== null && $this->serverSelectedId() == $sid) {
return;
}

$virtual = ($virtual !== null) ? $virtual : $this->start_offline_virtual;
$getargs = func_get_args();

if ($sid != 0 && $this->predefined_query_name !== null) {
$this->execute("use", ["sid" => $sid, "client_nickname" => (string)$this->predefined_query_name, $virtual ? "-virtual" : null]);
Expand Down Expand Up @@ -184,12 +185,13 @@ public function serverSelectById(int $sid, bool $virtual = null): void
*/
public function serverSelectByPort(int $port, bool $virtual = null): void
{
$getargs = func_get_args();

if ($this->whoami !== null && $this->serverSelectedPort() == $port) {
return;
}

$virtual = ($virtual !== null) ? $virtual : $this->start_offline_virtual;
$getargs = func_get_args();

if ($port != 0 && $this->predefined_query_name !== null) {
$this->execute("use", ["port" => $port, "client_nickname" => (string)$this->predefined_query_name, $virtual ? "-virtual" : null]);
Expand Down
10 changes: 10 additions & 0 deletions tests/Adapter/ServerQuery/ReplyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,11 @@ public function testToString()

public function testToLines()
{
$this->expectNotToPerformAssertions();
}
public function testToTable()
{
$this->expectNotToPerformAssertions();
}

/**
Expand All @@ -106,24 +108,31 @@ public function testToArray()

public function testToAssocArray()
{
$this->expectNotToPerformAssertions();
}
public function testToList()
{
$this->expectNotToPerformAssertions();
}
public function testToObjectArray()
{
$this->expectNotToPerformAssertions();
}
public function testGetCommandString()
{
$this->expectNotToPerformAssertions();
}
public function testGetNotifyEvents()
{
$this->expectNotToPerformAssertions();
}
public function testGetErrorProperty()
{
$this->expectNotToPerformAssertions();
}
public function testFetchError()
{
$this->expectNotToPerformAssertions();
//$this->assertInstanceOf(\TeamSpeak3_Adapter_ServerQuery_Reply::class, $reply);
//$this->assertInternalType(PHPUnit_IsType::TYPE_INT, $reply->getErrorProperty('id'));
//$this->assertEquals(0, $reply->getErrorProperty('id'));
Expand All @@ -132,5 +141,6 @@ public function testFetchError()
}
public function testFetchReply()
{
$this->expectNotToPerformAssertions();
}
}
5 changes: 5 additions & 0 deletions tests/Helper/ConvertTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,26 +230,31 @@ public function testConvertSecondsToHumanReadable()

public function testConvertCodecIDToHumanReadable()
{
$this->expectNotToPerformAssertions();
// @todo: Find logical / comprehensive test for checking codec names
}

public function testConvertGroupTypeIDToHumanReadable()
{
$this->expectNotToPerformAssertions();
// @todo: Find logical / comprehensive test for checking codec names
}

public function testConvertPermTypeIDToHumanReadable()
{
$this->expectNotToPerformAssertions();
// @todo: Find logical / comprehensive test for checking codec names
}

public function testConvertPermCategoryIDToHumanReadable()
{
$this->expectNotToPerformAssertions();
// @todo: Find logical / comprehensive test for checking codec names
}

public function testConvertLogLevelIDToHumanReadable()
{
$this->expectNotToPerformAssertions();
// @todo: Find logical / comprehensive test for checking codec names
}

Expand Down
Loading
Loading