Allow CssXPath updates with composer (#4368)

* Install CssXPath with composer

* Fix code style in tests

* fix pathnames for tests and linting

* add irrelevant files to .gitignore

* Alphabetic order

* let composer sort the packages alphabetically

Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
This commit is contained in:
Artur Weigandt 2022-05-16 12:04:43 +02:00 committed by GitHub
parent ffd1061850
commit d6fd78b968
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 31 additions and 12 deletions

View File

@ -1,4 +1,4 @@
lib/CssXPath/
lib/phpgt/
lib/phpmailer/
node_modules/
p/scripts/vendor/

View File

@ -29,7 +29,7 @@ extend-exclude = [
"bin/",
"data/",
"docs/fr/",
"lib/CssXPath/",
"lib/phpgt/",
"lib/phpmailer/",
"lib/SimplePie/",
"node_modules/",

6
lib/.gitignore vendored
View File

@ -1,6 +1,12 @@
autoload.php
composer.lock
composer/
phpgt/cssxpath/.github/
phpgt/cssxpath/.gitignore
phpgt/cssxpath/.scrutinizer.yml
phpgt/cssxpath/composer.json
phpgt/cssxpath/CONTRIBUTING.md
phpgt/cssxpath/test/
phpmailer/phpmailer/*oauth*
phpmailer/phpmailer/COMMITMENT*
phpmailer/phpmailer/composer.*

View File

@ -1,4 +0,0 @@
<?php
namespace Gt\CssXPath;
class NotYetImplementedException extends CssXPathException {}

View File

@ -6,9 +6,11 @@
"license": "AGPL-3.0",
"require": {
"php": ">=7.0.0",
"phpgt/cssxpath": "v1.1.4",
"phpmailer/phpmailer": "6.6.0"
},
"config": {
"sort-packages": true,
"vendor-dir": "./"
},
"scripts": {

View File

@ -52,8 +52,11 @@ function classAutoloader($class) {
include(LIB_PATH . '/' . str_replace('_', '/', $class) . '.php');
} elseif (strpos($class, 'SimplePie') === 0) {
include(LIB_PATH . '/SimplePie/' . str_replace('_', '/', $class) . '.php');
} elseif (strpos($class, 'CssXPath') !== false) {
include(LIB_PATH . '/CssXPath/' . basename(str_replace('\\', '/', $class)) . '.php');
} elseif (str_starts_with($class, 'Gt\\CssXPath\\')) {
$prefix = 'Gt\\CssXPath\\';
$base_dir = LIB_PATH . '/phpgt/cssxpath/src/';
$relative_class_name = substr($class, strlen($prefix));
require $base_dir . str_replace('\\', '/', $relative_class_name) . '.php';
} elseif (str_starts_with($class, 'PHPMailer\\PHPMailer\\')) {
$prefix = 'PHPMailer\\PHPMailer\\';
$base_dir = LIB_PATH . '/phpmailer/phpmailer/src/';

View File

@ -3,4 +3,4 @@ namespace Gt\CssXPath;
use RuntimeException;
class CssXPathException extends RuntimeException {}
class CssXPathException extends RuntimeException {}

View File

@ -0,0 +1,4 @@
<?php
namespace Gt\CssXPath;
class NotYetImplementedException extends CssXPathException {}

View File

@ -3,8 +3,8 @@
<description>Created with the PHP Coding Standard Generator. https://edorian.github.com/php-coding-standard-generator/</description>
<arg name="extensions" value="php,phtml,css,js"/>
<arg name="tab-width" value="4"/>
<exclude-pattern>./lib/CssXPath/</exclude-pattern>
<exclude-pattern>./lib/SimplePie/</exclude-pattern>
<exclude-pattern>./lib/phpgt/</exclude-pattern>
<exclude-pattern>./lib/phpmailer/</exclude-pattern>
<exclude-pattern>./lib/http-conditional.php</exclude-pattern>
<exclude-pattern>./node_modules/</exclude-pattern>

View File

@ -0,0 +1,8 @@
<?php
class CssXPathTest extends PHPUnit\Framework\TestCase
{
public function testCssXPathTranslatorClassExists() {
$this->assertTrue(class_exists('Gt\\CssXPath\\Translator'));
}
}

View File

@ -1,7 +1,7 @@
<?php
class PHPMailerTest extends PHPUnit\Framework\TestCase {
class PHPMailerTest extends PHPUnit\Framework\TestCase
{
public function testPHPMailerClassExists() {
$this->assertTrue(class_exists('PHPMailer\\PHPMailer\\PHPMailer'));
}