-
Notifications
You must be signed in to change notification settings - Fork 16
/
CompileCommandTest.php
51 lines (41 loc) 路 1.54 KB
/
CompileCommandTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
namespace Castor\Tests\Slow;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Process\Process;
class CompileCommandTest extends TestCase
{
public function test()
{
$castorAppDirPath = RepackCommandTest::setupRepackedCastorApp('castor-test-compile');
(new Process(
[
'vendor/jolicode/castor/bin/castor',
'repack',
'--os', 'linux',
],
cwd: $castorAppDirPath)
)->mustRun();
$binary = $castorAppDirPath . '/castor';
// If you update this command, you must also update the command in .github/actions/cache/action.yaml
(new Process(
[
'vendor/jolicode/castor/bin/castor',
'compile', $castorAppDirPath . '/my-app.linux.phar',
'--os', 'linux',
'--binary-path', $binary,
'--php-extensions', 'mbstring,phar,posix,tokenizer',
'-vvv',
],
cwd: $castorAppDirPath,
timeout: 5 * 60)
)->mustRun();
$this->assertFileExists($binary);
(new Process([$binary], cwd: $castorAppDirPath))->mustRun();
$p = (new Process([$binary, 'hello'], cwd: $castorAppDirPath))->mustRun();
$this->assertSame('hello', $p->getOutput());
// Twice, because we want to be sure the phar is not corrupted after a
// run
$p = (new Process([$binary, 'hello'], cwd: $castorAppDirPath))->mustRun();
$this->assertSame('hello', $p->getOutput());
}
}