Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Run Tests

on:
pull_request:
paths:
- '**.php'
- '.github/workflows/**'
- 'composer.json'
- 'phpunit.xml.dist'
push:
branches:
- develop
- master
paths:
- '**.php'
workflow_dispatch:

jobs:
tests:
name: PHPUnit Tests
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
extensions: curl
coverage: none

- name: Install dependencies
run: composer install --no-interaction --prefer-dist

- name: Run tests
run: bin/phpunit
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -142,3 +142,4 @@ fabric.properties
# *.ipr

# End of https://www.gitignore.io/api/linux,eclipse,phpstorm,netbeans,composer
.phpunit.cache/
119 changes: 119 additions & 0 deletions bin/php-parse
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
#!/usr/bin/env php
<?php

/**
* Proxy PHP file generated by Composer
*
* This file includes the referenced bin path (../vendor/nikic/php-parser/bin/php-parse)
* using a stream wrapper to prevent the shebang from being output on PHP<8
*
* @generated
*/

namespace Composer;

$GLOBALS['_composer_bin_dir'] = __DIR__;
$GLOBALS['_composer_autoload_path'] = __DIR__ . '/..'.'/vendor/autoload.php';

if (PHP_VERSION_ID < 80000) {
if (!class_exists('Composer\BinProxyWrapper')) {
/**
* @internal
*/
final class BinProxyWrapper
{
private $handle;
private $position;
private $realpath;

public function stream_open($path, $mode, $options, &$opened_path)
{
// get rid of phpvfscomposer:// prefix for __FILE__ & __DIR__ resolution
$opened_path = substr($path, 17);
$this->realpath = realpath($opened_path) ?: $opened_path;
$opened_path = $this->realpath;
$this->handle = fopen($this->realpath, $mode);
$this->position = 0;

return (bool) $this->handle;
}

public function stream_read($count)
{
$data = fread($this->handle, $count);

if ($this->position === 0) {
$data = preg_replace('{^#!.*\r?\n}', '', $data);
}

$this->position += strlen($data);

return $data;
}

public function stream_cast($castAs)
{
return $this->handle;
}

public function stream_close()
{
fclose($this->handle);
}

public function stream_lock($operation)
{
return $operation ? flock($this->handle, $operation) : true;
}

public function stream_seek($offset, $whence)
{
if (0 === fseek($this->handle, $offset, $whence)) {
$this->position = ftell($this->handle);
return true;
}

return false;
}

public function stream_tell()
{
return $this->position;
}

public function stream_eof()
{
return feof($this->handle);
}

public function stream_stat()
{
return array();
}

public function stream_set_option($option, $arg1, $arg2)
{
return true;
}

public function url_stat($path, $flags)
{
$path = substr($path, 17);
if (file_exists($path)) {
return stat($path);
}

return false;
}
}
}

if (
(function_exists('stream_get_wrappers') && in_array('phpvfscomposer', stream_get_wrappers(), true))
|| (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper'))
) {
return include("phpvfscomposer://" . __DIR__ . '/..'.'/vendor/nikic/php-parser/bin/php-parse');
}
}

return include __DIR__ . '/..'.'/vendor/nikic/php-parser/bin/php-parse';
9 changes: 6 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
}
],
"require" : {
"php" : ">=8",
"php" : "^8.3",
"ext-curl" : "*",
"symfony/console" : "~5 || ~6 || ~7"
},
"require-dev" : {
"phpunit/phpunit" : "~8"
"phpunit/phpunit" : "^10.0"
},
"autoload" : {
"psr-4" : {
Expand All @@ -32,6 +32,9 @@
"license" : "MIT",
"minimum-stability" : "stable",
"config" : {
"bin-dir" : "bin"
"bin-dir" : "bin",
"platform" : {
"php" : "8.3.0"
}
}
}
Loading