Add phpunit configuration file
Use the configuration file to pass the location of the tests and autoload class files. Pass -sp to phpcs command
This commit is contained in:
committed by
Niklas Laxström
parent
f216187aba
commit
6348e1589b
6
.github/workflows/php.yml
vendored
6
.github/workflows/php.yml
vendored
@@ -15,8 +15,8 @@ jobs:
|
||||
- name: Install dependencies
|
||||
run: composer install --prefer-dist --no-interaction --ansi
|
||||
|
||||
- name: Run tests
|
||||
run: php${{ matrix.php }} ./vendor/bin/phpunit tests/php/*
|
||||
|
||||
- name: Running phpcs
|
||||
run: composer run-script cs
|
||||
|
||||
- name: Run tests
|
||||
run: php${{ matrix.php }} ./vendor/bin/phpunit
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -16,6 +16,7 @@ yarn-error.log*
|
||||
|
||||
# PHP
|
||||
vendor/
|
||||
*.cache
|
||||
|
||||
# Docs
|
||||
docs/_build/
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
"email": "santhosh.thottingal@gmail.com"
|
||||
}
|
||||
],
|
||||
"type": "library",
|
||||
"require": {
|
||||
"php": ">=7.2",
|
||||
"mustangostang/spyc": "0.6.3"
|
||||
@@ -45,11 +44,11 @@
|
||||
},
|
||||
"scripts": {
|
||||
"fix": "phpcbf",
|
||||
"cs": "phpcs -p",
|
||||
"cs": "phpcs -sp",
|
||||
"test": [
|
||||
"composer validate --no-interaction",
|
||||
"phpunit tests/php/*",
|
||||
"phpcs -p"
|
||||
"@composer validate --no-interaction",
|
||||
"phpunit",
|
||||
"@cs"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
19
phpunit.xml
Normal file
19
phpunit.xml
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<phpunit
|
||||
bootstrap="vendor/autoload.php"
|
||||
beStrictAboutTestsThatDoNotTestAnything="true"
|
||||
beStrictAboutOutputDuringTests="true">
|
||||
|
||||
<testsuites>
|
||||
<testsuite name="Test suite">
|
||||
<directory>tests/php</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
|
||||
<filter>
|
||||
<whitelist>
|
||||
<directory suffix=".php">src/</directory>
|
||||
</whitelist>
|
||||
</filter>
|
||||
</phpunit>
|
||||
@@ -38,7 +38,7 @@ class LanguageUtil {
|
||||
/**
|
||||
* Returns an instance of the class that can be used to then call the other methods in the
|
||||
* class.
|
||||
* @return LanguageUtil
|
||||
* @return self
|
||||
*/
|
||||
public static function get(): LanguageUtil {
|
||||
if ( self::$instance === null ) {
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
<?php
|
||||
require __DIR__ . '/../../src/LanguageUtil.php';
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Wikimedia\LanguageData\LanguageUtil;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user