Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace Tests\Feature;
- use PHPUnit\Framework\TestCase;
- use Symfony\Component\Process\Process;
- class IntegrationTestCase extends TestCase
- {
- public const WEBSERVER_PORT = 8080;
- /**
- * @var Process
- */
- private static $webServerProcess;
- /**
- * @throws \Symfony\Component\Process\Exception\LogicException
- */
- public static function setUpBeforeClass()
- {
- self::$webServerProcess = new Process([
- 'php',
- '-S',
- 'localhost:' . self::WEBSERVER_PORT,
- '-t',
- \dirname(__FILE__)
- ]);
- self::$webServerProcess->start();
- usleep(100000); //wait for server to get going
- }
- /**
- * @throws \Symfony\Component\Process\Exception\LogicException
- */
- public static function tearDownAfterClass()
- {
- self::$webServerProcess->stop();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement