summaryrefslogtreecommitdiff
path: root/tests/PHPUnit/Extensions/ServerExtension/PreRunSubscriber.php
blob: db5cdb42a31fb4237bdcb8c634f6d66516be82df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php

namespace Tests\PHPUnit\Extensions\ServerExtension;

use PHPUnit\Event\TestRunner\ExecutionStarted;
use PHPUnit\Event\TestRunner\ExecutionStartedSubscriber;

class PreRunSubscriber implements ExecutionStartedSubscriber
{
  public function __construct(private \stdClass $dataObject)
  {}

  public function notify(ExecutionStarted $event): void
  {
    $this->dataObject->process_id = (int)shell_exec("php -S localhost:8080 -t public > /dev/null 2>&1 & echo $!");
    sleep(1);
  }
}