planetteamspeak / ts3phpframework

Modern use-at-will framework that provides individual components to manage TeamSpeak 3 Server instances
https://www.planetteamspeak.com
GNU General Public License v3.0
211 stars 59 forks source link

Issue #187: Callbacks for events are not being executed #190

Closed Sebbo94BY closed 1 year ago

Sebbo94BY commented 1 year ago

Summary

The class name now contains the full namespace path, so we need to replace the \ instead of the _.

Resolves #187

Debugging Info

$ git diff src/Transport/TCP.php
diff --git a/src/Transport/TCP.php b/src/Transport/TCP.php
index 02ce50a..f19a622 100644
--- a/src/Transport/TCP.php
+++ b/src/Transport/TCP.php
@@ -153,6 +153,7 @@ class TCP extends Transport

             $data = @fgets($this->stream, 4096);

+            var_dump( strtolower($this->getAdapterType()) );
             Signal::getInstance()->emit(strtolower($this->getAdapterType()) . "DataRead", $data);

             if ($data === false) {

Before (without this fix):

string(55) "planetteamspeak\teamspeak3framework\adapter\serverquery"

After (with this fix):

string(11) "serverquery"

PHPUnit Tests

Before (without this fix):

$ ./vendor/bin/phpunit --no-coverage tests/Transport/TransportTest.php 
PHPUnit 9.6.3 by Sebastian Bergmann and contributors.

F                                                                   1 / 1 (100%)

Time: 00:00.088, Memory: 6.00 MB

There was 1 failure:

1) PlanetTeamSpeak\TeamSpeak3Framework\Tests\Transport\TransportTest::testGetAdapterTypeReturnValues
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'MockServerQuery'
+'PlanetTeamSpeak\TeamSpeak3Framework\Adapter\MockServerQuery'

C:\Users\Sebastian\Downloads\ts3phpframework\tests\Transport\TransportTest.php:27

FAILURES!
Tests: 1, Assertions: 1, Failures: 1.

After (with this fix):

$ ./vendor/bin/phpunit --no-coverage tests/Transport/TransportTest.php 
PHPUnit 9.6.3 by Sebastian Bergmann and contributors.

.                                                                   1 / 1 (100%)

Time: 00:00.009, Memory: 6.00 MB

OK (1 test, 2 assertions)