Advertisement
Guest User

Untitled

a guest
Apr 2nd, 2019
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.90 KB | None | 0 0
  1. <?php
  2.  
  3. namespace Tests\Feature;
  4.  
  5. use PHPUnit\Framework\TestCase;
  6. use Symfony\Component\Process\Process;
  7.  
  8. class IntegrationTestCase extends TestCase
  9. {
  10.     public const WEBSERVER_PORT = 8080;
  11.  
  12.     /**
  13.      * @var Process
  14.      */
  15.     private static $webServerProcess;
  16.  
  17.     /**
  18.      * @throws \Symfony\Component\Process\Exception\LogicException
  19.      */
  20.     public static function setUpBeforeClass()
  21.     {
  22.         self::$webServerProcess = new Process([
  23.             'php',
  24.             '-S',
  25.             'localhost:' . self::WEBSERVER_PORT,
  26.             '-t',
  27.             \dirname(__FILE__)
  28.         ]);
  29.         self::$webServerProcess->start();
  30.         usleep(100000); //wait for server to get going
  31.     }
  32.  
  33.     /**
  34.      * @throws \Symfony\Component\Process\Exception\LogicException
  35.      */
  36.     public static function tearDownAfterClass()
  37.     {
  38.         self::$webServerProcess->stop();
  39.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement