Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
104 commits
Select commit Hold shift + click to select a range
1720a69
enhanced test can be deleted by class ServerGroup()
MajorOli Oct 26, 2025
01e8940
Breaking Change Remove Viewer: my opinion is to create a modern viewe…
MajorOli Oct 26, 2025
82bfd64
clean code associated with remove viewer
MajorOli Oct 26, 2025
cb30eb2
add test_can_get_by_clientGetByDbid
MajorOli Oct 26, 2025
3d242ba
return now an array with client name and database id specified with $…
MajorOli Oct 26, 2025
05eb0e8
add test_can_clientGetNameByUid to validate clientGetNameByUid
MajorOli Oct 26, 2025
67294a2
return now an array with client name and uid
MajorOli Oct 26, 2025
52dcbcb
add test_can_clientGetNameByDbid to validate clientGetNameByDbid
MajorOli Oct 26, 2025
515b5b7
clientPermAssign change continueonerror as separat flag
MajorOli Oct 26, 2025
9ddc1f8
clientPermList handle empty database error
MajorOli Oct 26, 2025
8172e1c
add test_can_handle_permission to validate clientPermList and Client…
MajorOli Oct 26, 2025
3349762
documentation, code style
MajorOli Oct 26, 2025
b4c332e
setup ChannelGroupTest.php
MajorOli Oct 26, 2025
bf2ed7c
update define parameter
MajorOli Oct 26, 2025
b8c2d1c
lang
MajorOli Oct 26, 2025
c9b2f67
fix channelGroupCopy should now return an cgid as int
MajorOli Oct 26, 2025
13906b2
add test_can_get_channelgroup_by_name test_can_rename_channelgroup te…
MajorOli Oct 26, 2025
808ae2b
fix missing type
MajorOli Oct 26, 2025
20edde7
add test_can_assign_remove_permissions_to_channelgroup to validate pe…
MajorOli Oct 26, 2025
fd1aa92
fix array handling at channelGroupClientList and fix issue with $reso…
MajorOli Oct 26, 2025
e9f13ac
change channelGroupList to return the correct type. An id should be a…
MajorOli Oct 26, 2025
c3e3b74
add test_channelGroupList
MajorOli Oct 26, 2025
a22288b
code-style
MajorOli Oct 26, 2025
2208935
change test_can_move_user to test chaining via Client.php
MajorOli Oct 27, 2025
291c11c
fix missing type at client->prmRemove()
MajorOli Oct 27, 2025
2b88b83
change test_can_handle_permission to chaining Client.php
MajorOli Oct 27, 2025
abf119a
change test_can_ban_user to chaining Client.php
MajorOli Oct 27, 2025
b51d695
add enhance test to validate ban and kick with multiple Testusers. Ch…
MajorOli Oct 27, 2025
7dcc4e6
fix assert if multiple UnitTestUsers online
MajorOli Oct 27, 2025
c046f09
move test_channelGroupClientList to ClientTest to validate channeladd…
MajorOli Oct 27, 2025
b497102
enhance test to validate chaining over Client.php
MajorOli Oct 27, 2025
e748588
add test_has_overwolf
MajorOli Oct 27, 2025
37c4de3
add test_channelGroupClientList validate chaining from ChannelGroup.php
MajorOli Oct 31, 2025
bc6dceb
add extend tests with a second UnitTestUser
MajorOli Nov 1, 2025
f78c57b
fix channelClientPermList
MajorOli Nov 1, 2025
e4d0a89
add test_can_handle_permission_chain_channel to validate permission h…
MajorOli Nov 1, 2025
c369248
change .env.testing.example to define a second UnitTestUser for exten…
MajorOli Nov 1, 2025
97306d1
change to test channel permission with chaining over Channel.php -> S…
MajorOli Nov 1, 2025
4dbb138
remove Returns the HTML code to display a TeamSpeak 3 viewer.
MajorOli Nov 1, 2025
65d1967
improve test via chaining Client..php
MajorOli Nov 1, 2025
f656571
access the correct array, there can find the count value. [0] most co…
MajorOli Nov 1, 2025
e0f7f67
improve test_can_get_clientInfoDB to validate server->clientCountDb()
MajorOli Nov 1, 2025
048cee1
quality
MajorOli Nov 1, 2025
e817939
change server->clientInfoDb() to get an flatten array with expected v…
MajorOli Nov 1, 2025
9477904
improve test_can_get_clientInfoDB to validate changes at server->clie…
MajorOli Nov 1, 2025
d74ca1a
remove flatting because we flatt the array already in server->clientI…
MajorOli Nov 1, 2025
3750603
flatt array with cldbid directly from clientInfoDb()
MajorOli Nov 1, 2025
7209a85
fix send Textmessage to all clients in a specific channelGroup. Not i…
MajorOli Nov 1, 2025
59f1029
improve test_can_send_client_group_text_message to validate can send …
MajorOli Nov 1, 2025
99058ae
remove unused var
MajorOli Nov 1, 2025
8a52988
code-style
MajorOli Nov 1, 2025
7608843
change Host->version() to get back only an array with all version Inf…
MajorOli Nov 2, 2025
f2a13ef
change Host->serverIdGetByPort [0] = Meta [1] = Data
MajorOli Nov 2, 2025
fbe16e5
change return server data array
MajorOli Nov 2, 2025
aa36266
parameter "-new" does not exist in api documentation.
MajorOli Nov 2, 2025
a7e1e80
Revert "parameter "-new" does not exist in api documentation."
MajorOli Nov 2, 2025
77c81cb
missed full qualified classname
MajorOli Nov 2, 2025
fff73f0
fix fetchPermissionList()
MajorOli Nov 2, 2025
4c5bbce
change toString() at StringHelper function permissionTree
MajorOli Nov 2, 2025
c0dd917
fix permissionFind and catch error when permission is removed / inactive
MajorOli Nov 2, 2025
ee0d00e
add test_can_get_host_information
MajorOli Nov 2, 2025
80793d7
code-style
MajorOli Nov 2, 2025
a9354e9
fix remove meta and return a flat array
MajorOli Nov 8, 2025
11af384
validate fix for selfPermCheck()
MajorOli Nov 8, 2025
92b369e
fix logview to get only log entrys
MajorOli Nov 8, 2025
280191f
fix queryCountLogin to return an integer instead of an array. Count i…
MajorOli Nov 8, 2025
12f6802
the function currently isn't found in a use case
MajorOli Nov 8, 2025
55b21a3
validate handle logview and queryList and queryCount
MajorOli Nov 8, 2025
65dc931
add exclude Exceptions directory. Most Exceptions are empty
MajorOli Nov 8, 2025
4ea340b
code-style
MajorOli Nov 8, 2025
0904bc4
validate group->getSymbol()
MajorOli Nov 8, 2025
51d31d2
extend test to validate permOverview()
MajorOli Nov 8, 2025
3be381b
code-style
MajorOli Nov 8, 2025
0c4330a
issue at return type declaration
MajorOli Nov 9, 2025
11cf75d
fix at convert issue
MajorOli Nov 9, 2025
59518b4
fix at convert issue UTF-8
MajorOli Nov 9, 2025
d62b567
extend test to proof complete Char->toUnicode() function
MajorOli Nov 9, 2025
cd3f6b3
add testFromHexFailed()
MajorOli Nov 9, 2025
481223c
add testUnicodeFailed()
MajorOli Nov 9, 2025
a9303ad
style
MajorOli Nov 9, 2025
0ec4a15
extend convertTest to validate ms seconds block
MajorOli Nov 9, 2025
f6f94dd
extend test to validate convert log entrys
MajorOli Nov 9, 2025
119acb0
extend test to return alternative mimeType
MajorOli Nov 9, 2025
9fe2f84
add testIconIdUnsignedBelowThreshold() and testIconIdUnsignedWithHigh…
MajorOli Nov 9, 2025
eae1a7f
add tests for StringHelper->resize()
MajorOli Nov 9, 2025
479ed9b
add test to validate StringHelper->filterAlnum()
MajorOli Nov 9, 2025
1c9dd6a
add tests to validate StringHelper->filterAlpha()
MajorOli Nov 9, 2025
2cdea84
add tests to validate StringHelper->uriSafe()
MajorOli Nov 9, 2025
58b1f98
add test to validate magical functions __call
MajorOli Nov 9, 2025
0d4ba84
add testKeyReturnsCurrentPosition()
MajorOli Nov 9, 2025
070a46c
add tests to validate StringHelper->offsetExists()
MajorOli Nov 9, 2025
277e9ed
add tests to validate StringHelper->offsetGet()
MajorOli Nov 9, 2025
fab0081
add tests to validate StringHelper->offsetSet()
MajorOli Nov 9, 2025
4ec9c54
add tests to validate StringHelper->offsetUnset()
MajorOli Nov 9, 2025
d441937
add namespace
MajorOli Nov 9, 2025
cf87694
add test to validate StringHelper->toInt()
MajorOli Nov 9, 2025
cdfe772
add tests to validate StringHelper->filterDigits()
MajorOli Nov 9, 2025
8e85696
add tests to validate StringHelper->unescape()
MajorOli Nov 9, 2025
79666d0
add tests to validate Uri->check()
MajorOli Nov 9, 2025
fbf6fc0
add tests to validate Uri->getFQDNParts
MajorOli Nov 9, 2025
dace4f4
add test to validate Uri->stripslashesRecursive()
MajorOli Nov 9, 2025
7f2724a
add namespace ReflectionMethod
MajorOli Nov 9, 2025
07cfe90
code-style
MajorOli Nov 9, 2025
d52a502
Merge branch 'main' into ts-x-refactoring-dev
MajorOli Nov 9, 2025
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
1 change: 1 addition & 0 deletions .env.testing.example
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ DEV_LIVE_SERVER_UNIT_TEST_CHANNEL=UnitTest
DEV_LIVE_SERVER_UNIT_TEST_USER_ACTIVE=false
DEV_LIVE_SERVER_UNIT_TEST_USER=UnitTestUser
DEV_LIVE_SERVER_UNIT_TEST_SIGNALS=false
DEV_LIVE_SERVER_UNIT_TEST_USER_EXTEND=
23 changes: 1 addition & 22 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,3 @@
# How to contribute

We are open to contributions from everyone! 3rd-party support goes a long way
towards maintaining and improving the framework. Nothing is too small, from pull
requests to reporting bugs, everything helps!

## Ways to contribute

* Having trouble or find a bug? [Open an
issue!](https://github.com/planetteamspeak/ts3phpframework/issues/new)
* Add a feature or fix a bug:
* Check for existing issue or create a new one.
* Fork the repo, make your changes.
* Create a pull request, and reference the issue.
* Add examples, tests, or improve documentation.

## Test

When committing code, please make sure to test before creating a pull request.

We use PHPUnit for testing, feel free to add new tests. This is not a
requirement, but helps us maintain code coverage.

@ToDo: Add sections: test environment setup, running tests, examples
* Having trouble or find a bug? [Open an issue!](https://github.com/Prestige-Solution/ts-x-php-framework/issues)
2 changes: 1 addition & 1 deletion doc/coverage/coverage-badge.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@
<directory>./tests</directory>
<directory>./build</directory>
<directory>./vendor</directory>
<file>./src/Exception/AdapterException.php</file>
<file>./src/Exception/FileTransferException.php</file>
<file>./src/Exception/HelperException.php</file>
<file>./src/Exception/NodeException.php</file>
<file>./src/Exception/ProfilerException.php</file>
<file>./src/Exception/SignalException.php</file>
<file>./src/Exception/TransportException.php</file>
<file>./src/Helper/Signal/SignalInterface.php</file>
</exclude>
</source>
<coverage ignoreDeprecatedCodeUnits="true"
Expand Down
17 changes: 12 additions & 5 deletions src/Helper/Char.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ class Char
*/
public function __construct(string $char)
{
if (strlen($char) != 1) {
throw new HelperException('char parameter may not contain more or less than one character');
if (mb_strlen($char, 'UTF-8') !== 1) {
throw new HelperException('char parameter may not contain more or less than one UTF-8 character');
}

$this->char = $char;
Expand Down Expand Up @@ -167,7 +167,7 @@ public function toUnicode(): int
if ($h <= 0x7F) {
return $h;
} elseif ($h < 0xC2) {
return false;
return -1;
} elseif ($h <= 0xDF) {
return ($h & 0x1F) << 6 | (ord($this->char[1]) & 0x3F);
} elseif ($h <= 0xEF) {
Expand Down Expand Up @@ -198,11 +198,18 @@ public function toHex(): string
*/
public static function fromHex(string $hex): self
{
if (strlen($hex) != 2) {
// Check: only even numbers of hex characters allowed, all must be valid
if (strlen($hex) % 2 !== 0 || ! ctype_xdigit($hex)) {
throw new HelperException("given parameter '".$hex."' is not a valid hexadecimal number");
}

return new self(chr(hexdec($hex)));
// Hex → Binary string (UTF-8 compatible)
$bytes = hex2bin($hex);
if ($bytes === false) {
throw new HelperException("given parameter '".$hex."' could not be converted to binary data");
}

return new self($bytes);
}

/**
Expand Down
14 changes: 0 additions & 14 deletions src/Node/Channel.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@
*/
class Channel extends Node
{
private array|null $clientList = null;

private array $channelList = [];

/**
* Channel constructor.
*
Expand Down Expand Up @@ -558,16 +554,6 @@ protected function fetchNodeInfo(): void
$this->nodeInfo = array_merge($this->nodeInfo, $this->execute('channelinfo', ['cid' => $this->getId()])->toList());
}

/**
* Returns a unique identifier for the node which can be used as an HTML property.
*
* @return string
*/
public function getUniqueId(): string
{
return $this->getParent()->getUniqueId().'_ch'.$this->getId();
}

/**
* Returns the name of a possible icon to display the node object.
*
Expand Down
20 changes: 5 additions & 15 deletions src/Node/ChannelGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,14 @@ public function permList(bool $permsid = false): array
* Adds a set of specified permissions to the channel group. Multiple permissions
* can be added by providing the two parameters of each permission in separate arrays.
*
* @param int $permid
* @param int $permvalue
* @param int|array $permid
* @param int|array $permvalue
* @return void
* @throws AdapterException
* @throws ServerQueryException
* @throws TransportException
*/
public function permAssign(int $permid, int $permvalue): void
public function permAssign(int|array $permid, int|array $permvalue): void
{
$this->getParent()->channelGroupPermAssign($this->getId(), $permid, $permvalue);
}
Expand All @@ -114,13 +114,13 @@ public function permAssign(int $permid, int $permvalue): void
* Removes a set of specified permissions from the channel group. Multiple
* permissions can be removed at once.
*
* @param int $permid
* @param int|array $permid
* @return void
* @throws AdapterException
* @throws ServerQueryException
* @throws TransportException
*/
public function permRemove(int $permid): void
public function permRemove(int|array $permid): void
{
$this->getParent()->channelGroupPermRemove($this->getId(), $permid);
}
Expand Down Expand Up @@ -172,16 +172,6 @@ protected function fetchNodeList(): void
}
}

/**
* Returns a unique identifier for the node which can be used as an HTML property.
*
* @return string
*/
public function getUniqueId(): string
{
return $this->getParent()->getUniqueId().'_cg'.$this->getId();
}

/**
* Returns the name of a possible icon to display the node object.
*
Expand Down
14 changes: 2 additions & 12 deletions src/Node/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -293,13 +293,13 @@ public function permAssign(int|array $permid, int|array $permvalue, array|bool $
/**
* Removes a set of specified permissions from a client. Multiple permissions can be removed at once.
*
* @param int $permid
* @param array|int $permid
* @return void
* @throws AdapterException
* @throws ServerQueryException
* @throws TransportException
*/
public function permRemove(int $permid): void
public function permRemove(array|int $permid): void
{
$this->getParent()->clientPermRemove($this['client_database_id'], $permid);
}
Expand Down Expand Up @@ -527,16 +527,6 @@ protected function fetchNodeInfo(): void
}
}

/**
* Returns a unique identifier for the node which can be used as an HTML property.
*
* @return string
*/
public function getUniqueId(): string
{
return $this->getParent()->getUniqueId().'_cl'.$this->getId();
}

/**
* Returns the name of a possible icon to display the node object.
*
Expand Down
9 changes: 7 additions & 2 deletions src/Node/Group.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,14 @@ abstract class Group extends Node
*/
public function message(string $msg): void
{
foreach ($this as $client) {
// get all clients in this group
$clients = $this->getParent()->channelGroupClientList($this->getId());

// get client id from dbid and send a textmessage
foreach ($clients as $client) {
try {
$this->execute('sendtextmessage', ['msg' => $msg, 'target' => $client, 'targetmode' => TeamSpeak3::TEXTMSG_CLIENT]);
$targetClientID = $this->getParent()->clientgetbydbid($client['cldbid'])->getId();
$this->execute('sendtextmessage', ['msg' => $msg, 'target' => $targetClientID, 'targetmode' => TeamSpeak3::TEXTMSG_CLIENT]);
} catch (ServerQueryException $e) {
/* ERROR_client_invalid_id */
if ($e->getCode() != 0x0200) {
Expand Down
Loading