Unit tests and I/O bindings (#8)

* Added composer config, added IO/error tests using phpunit

* Added ApiGen doc comments

* Added test to ensure last_error is not set from loading up the CRT
This commit is contained in:
Justin Boswell
2021-02-09 10:26:41 -08:00
committed by GitHub
parent 3fed547551
commit 7b5ccfd55a
10 changed files with 1686 additions and 8 deletions
+27
View File
@@ -0,0 +1,27 @@
<?php
require_once('crt.php');
final class EventLoopGroupOptions {
/**
* @var int $num_threads - Number of worker threads in the EventLoopGroup. Defaults to 0/1 per logical core.
*/
public $num_threads = 0;
}
/**
* Represents 1 or more event loops (1 per thread) for doing I/O and background tasks.
* Typically, every application has one EventLoopGroup.
*/
final class EventLoopGroup extends NativeResource {
function __construct($options) {
parent::__construct();
$this->acquire(self::$crt->event_loop_group_new($options->num_threads));
}
function __destruct() {
self::$crt->event_loop_group_release($this->native);
$this->release();
parent::__destruct();
}
}