-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add more unit tests for PreProcessor::commentOut()
- Loading branch information
Showing
3 changed files
with
69 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
tests/muqsit/preprocessor/samples/comment-out-method-call.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace muqsit\preprocessor; | ||
|
||
use Closure; | ||
use Logger; | ||
use PrefixedLogger; | ||
use pocketmine\entity\Entity; | ||
use pocketmine\player\Player; | ||
use pocketmine\plugin\PluginBase; | ||
use pocketmine\utils\Utils; | ||
use Ramsey\Uuid\Uuid; | ||
|
||
final class SampleLoggerDebug extends PluginBase{ | ||
|
||
/** @var Logger */ | ||
private $l1; | ||
|
||
private Logger $l2; | ||
|
||
protected function onEnable() : void{ | ||
$this->getLogger()->debug("Plugin enabled timestamp: " . time()); | ||
|
||
$logger = $this->getServer()->getLogger(); | ||
$logger->debug("Logging from {$this->getName()}"); | ||
|
||
$logger->notice("This isn't a debug message"); | ||
|
||
$child = new PrefixedLogger($this->getLogger(), "Prefix"); | ||
$child->debug("Hello world"); | ||
|
||
$this->l1->debug("test phpdoc typed property"); | ||
$this->l2->debug("test native typed property"); | ||
|
||
$l = $this->l1; | ||
$l->info("x"); $l->debug("y"); $l->notice("z"); | ||
} | ||
|
||
/** | ||
* @param Closure(Player) : bool $listener | ||
*/ | ||
public function registerPlayerListener(Closure $listener) : void{ | ||
Utils::validateCallableSignature(static fn(Player $player) : bool => true, $listener); | ||
$listener($this->getServer()->getPlayerByUUID(Uuid::fromString(Uuid::NIL))); | ||
} | ||
|
||
/** | ||
* @param Closure(Entity) : bool $listener | ||
*/ | ||
public function registerEntityListener(Closure $listener) : void{ | ||
$utils = Utils::class; | ||
$utils::validateCallableSignature(static fn(Entity $entity) : bool => true, $listener); | ||
$listener($this->getServer()->getWorldManager()->findEntity(0)); | ||
} | ||
} |
28 changes: 0 additions & 28 deletions
28
tests/muqsit/preprocessor/samples/logger-debug-method-call.php
This file was deleted.
Oops, something went wrong.