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
54 changes: 0 additions & 54 deletions .circleci/config.yml

This file was deleted.

42 changes: 42 additions & 0 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: PHPUnit

on:
push:
branches: [ master, '2.0' ]
pull_request:
branches: [ master, '2.0' ]

jobs:
test:
runs-on: ubuntu-latest

name: PHP 7.4

steps:
- name: Checkout
uses: actions/checkout@v7

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
extensions: bcmath
coverage: xdebug

# The 2.x dev dependencies (PHPUnit, Guzzle 6) carry security advisories that Composer blocks by default
- name: Install dependencies
run: composer install --no-interaction --prefer-dist --no-progress --no-blocking

- name: Run PHPUnit
run: vendor/bin/phpunit --coverage-text=coverage.txt

- name: Check coverage
run: |
cat coverage.txt
COVERAGE=$(grep -A3 'Summary:' coverage.txt | grep 'Lines:' | grep -oP '\d+\.\d+(?=%)')
THRESHOLD=98
if (( $(echo "$COVERAGE < $THRESHOLD" | bc -l) )); then
echo "Coverage is $COVERAGE%, below ${THRESHOLD}% threshold"
exit 1
fi
echo "Coverage is $COVERAGE% (threshold: ${THRESHOLD}%)"
16 changes: 0 additions & 16 deletions .travis.yml

This file was deleted.

11 changes: 8 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"allow-plugins": false
},
"require": {
"php": ">=7.0",
"php": "~7.4",
Comment thread
TomK marked this conversation as resolved.
Resolved
"psr/log": "~1.0",
"illuminate/container": "~5.4",
"illuminate/support": "~5.4",
Expand All @@ -27,7 +27,7 @@
"monolog/monolog": "~1.10",
"packaged/figlet": "~0",
"packaged/config": "~1.0",
"packaged/helpers": "~1.0",
"packaged/helpers": "^1.17.1|~2.0",
"packaged/api": "~1.0",
"symfony/http-foundation": "~3.2",
"symfony/http-kernel": "~3.2",
Expand All @@ -42,11 +42,16 @@
"mockery/mockery": "~0.9",
"guzzlehttp/guzzle": "~6.3",
"geoip2/geoip2": "~2.1",
"phpunit/phpunit": "~6.3"
"phpunit/phpunit": "~9"
Comment thread
TomK marked this conversation as resolved.
Resolved
},
"autoload": {
"psr-4": {
"Cubex\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"CubexTest\\": "tests/"
}
}
}
22 changes: 7 additions & 15 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit backupGlobals="false"
backupStaticAttributes="false"
colors="true"
processIsolation="false"
stopOnFailure="false"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
bootstrap="tests/bootstrap.php"
>
>
<php>
<ini name="date.timezone" value="UTC"/>
</php>
Expand All @@ -19,14 +16,9 @@
<directory>./tests/Cubex</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<coverage>
<include>
<directory suffix=".php">src</directory>
</whitelist>
<blacklist>
<directory suffix=".php">vendor</directory>
<directory suffix=".php">testing</directory>
<directory suffix=".php">tests</directory>
</blacklist>
</filter>
</include>
</coverage>
</phpunit>
8 changes: 4 additions & 4 deletions src/Cubex.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ public function prepareCubex()

foreach($files as $fileName)
{
$file = Path::build($this->getProjectRoot(), 'conf', $fileName);
$file = Path::system($this->getProjectRoot(), 'conf', $fileName);
try
{
$config->loadFile($file, true);
Expand Down Expand Up @@ -330,13 +330,13 @@ public function handle(
if($request->getRequestUri() === '/favicon.ico')
{
$favIconPaths = [];
$favIconPaths[] = Path::build($this->getProjectRoot(), 'favicon.ico');
$favIconPaths[] = Path::build(
$favIconPaths[] = Path::system($this->getProjectRoot(), 'favicon.ico');
$favIconPaths[] = Path::system(
$this->getProjectRoot(),
'assets',
'favicon.ico'
);
$favIconPaths[] = Path::build(dirname(__DIR__), 'favicon.ico');
$favIconPaths[] = Path::system(dirname(__DIR__), 'favicon.ico');
$favPath = null;

foreach($favIconPaths as $favPath)
Expand Down
8 changes: 4 additions & 4 deletions src/Kernel/CubexKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ public function findRoute(Request $request)
try
{
$route = $router->process(
Path::buildUnix($this->_pathProcessed, $path)
Path::url($this->_pathProcessed, $path)
);
$this->_pathProcessed = null;
}
Expand Down Expand Up @@ -296,7 +296,7 @@ public function autoRoute(Request $request, $pathParts)
foreach($subRoutes as $subRoute)
{
//Half sprintf style, but changed to str_replace for multiple instances
$attempt = Path::buildWindows(
$attempt = Path::windows(
$namespace,
str_replace('%s', $classPath, $subRoute)
);
Expand Down Expand Up @@ -351,7 +351,7 @@ public function executeRoute(
if(stripos($value, '\\') !== false && preg_match($match, $value))
{
$class = $value;
$nsClass = Path::buildWindows(Objects::getNamespace($this), $value);
$nsClass = Path::windows(Objects::getNamespace($this), $value);

try
{
Expand Down Expand Up @@ -409,7 +409,7 @@ public function executeRoute(

if($value instanceof CubexKernel)
{
$value->_pathProcessed = Path::buildUnix(
$value->_pathProcessed = Path::url(
$this->_pathProcessed,
$route->getMatchedPath()
);
Expand Down
2 changes: 1 addition & 1 deletion src/Routing/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ protected function _processRoutes($url, $routes)
{
return $this->createRoute(
$subMatch->getValue(),
Path::buildUnix($matchedPath, $subMatch->getMatchedPath())
Path::url($matchedPath, $subMatch->getMatchedPath())
);
}
return null;
Expand Down
2 changes: 1 addition & 1 deletion src/Testing/CubexTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public function assertResponseContains($expect, TestResponse $response = null)
{
$response = $this->_lastResponse;
}
$this->assertContains($expect, $response->getContent());
$this->assertStringContainsString($expect, $response->getContent());
}

/**
Expand Down
6 changes: 3 additions & 3 deletions src/View/ViewModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,14 @@ protected function _calculateTemplateDefaults()
$this->_templateDir = dirname($this->_templateDir);
}

$this->_templateDir = Path::build(
$this->_templateDir = Path::system(
$this->_templateDir,
$this->_templateDirName
);

if($this->_templateFile === null)
{
$this->_templateFile = Path::buildCustom(
$this->_templateFile = Path::custom(
DIRECTORY_SEPARATOR,
array_reverse($nesting)
);
Expand All @@ -155,7 +155,7 @@ protected function _calculateTemplateDefaults()
*/
public function getTemplatePath($extension = '.phtml')
{
return Path::build(
return Path::system(
$this->getTemplateDir(),
$this->getTemplateFile()
) . $extension;
Expand Down
9 changes: 4 additions & 5 deletions tests/Cubex/Auth/Providers/IPAuthProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@ public function testLogout()
public function testForgottenPassword()
{
$auth = new IPAuthProvider();
$this->expectException(
'\Exception',
'Forgotten Password is not available'
);
$this->expectException('\Exception');
$this->expectExceptionMessage('Forgotten Password is not available');
$auth->forgottenPassword('user');
}

Expand All @@ -45,7 +43,8 @@ public function testRetrieve(
{
if($exception !== null)
{
$this->expectException('\Exception', $exception);
$this->expectException('\Exception');
$this->expectExceptionMessage($exception);
}

$cnf = [];
Expand Down
4 changes: 2 additions & 2 deletions tests/Cubex/Console/Commands/BuiltInWebServerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ public function testCommand(array $options, $passthru, $negate = false)
$bufferOut = $this->getCommandOutput($command, $options);
if($negate)
{
$this->assertNotContains($passthru, $bufferOut);
$this->assertStringNotContainsString($passthru, $bufferOut);
}
else
{
$this->assertContains($passthru, $bufferOut);
$this->assertStringContainsString($passthru, $bufferOut);
}
}

Expand Down
10 changes: 4 additions & 6 deletions tests/Cubex/Console/ConsoleCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function testClassDocBlocks()
public function testOutput()
{
$command = new TestConsoleCommand();
$this->assertContains(
$this->assertStringContainsString(
'First: Brooke
Last: Bryan
Middle(s): Anthony James',
Expand All @@ -65,7 +65,7 @@ public function testOutput()
public function testOutputProcess()
{
$command = new TestProcessConsoleCommand();
$this->assertContains(
$this->assertStringContainsString(
'First: Brooke
Last: Bryan
Middle(s): Anthony James',
Expand All @@ -90,10 +90,8 @@ public function testUnfinishedCommand()
public function testSetCubex()
{
$command = new TestProcessConsoleCommand();
$this->expectException(
'Exception',
'Cubex is controlled by the application'
);
$this->expectException('Exception');
$this->expectExceptionMessage('Cubex is controlled by the application');
$command->setCubex(new \Cubex\Cubex());
}
}
Expand Down
6 changes: 3 additions & 3 deletions tests/Cubex/Console/ConsoleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ public function testDoRun()
$console->doRun($input, $output);
$buffered = $output->fetch();

$this->assertContains('phpserver', $buffered);
$this->assertContains('Namer', $buffered);
$this->assertContains(
$this->assertStringContainsString('phpserver', $buffered);
$this->assertStringContainsString('Namer', $buffered);
$this->assertStringContainsString(
'Command [broken] does not reference a valid class',
$buffered
);
Expand Down
Loading
Loading