rosavox/lib/alveolata/server/test.spec.php
2025-05-23 07:33:29 +00:00

46 lines
1 KiB
PHP

<?php
require_once(DIR_ALVEOLATA . '/server/functions.php');
require_once(DIR_ALVEOLATA . '/server/wrapper-class.php');
\alveolata\test\add(
[
'name' => 'alveolata',
'sections' => [
[
'name' => 'server',
'sections' => [
[
'active' => false,
'name' => 'test',
'cases' => [
[
'name' => 'should be killable',
'procedure' => function ($assert, &$environment) {
class thread1 extends \Thread {
public function __construct($server) {$this->server = $server;}
public function run() {$this->server->start();}
}
class thread2 extends \Thread {
public function __construct($server) {$this->server = $server;}
public function run() {sleep(1); $this->server->stop();}
}
$server = \alveolata\server\make(
7777,
function () {},
true
);
(new thread1($server))->run();
(new thread2($server))->run();
},
],
]
],
]
]
]
]
);
?>