Skip to content
Open
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/vendor
composer.lock
clover.xml
.phpunit.result.cache
phpunit.xml.bak
14 changes: 3 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
language: php

php:
- 5.5
- 5.6
- 7.0
- hhvm
- nightly

matrix:
allow_failures:
- php: 5.5
- php: nightly
- 7.4
- 8.0

install:
- composer install --dev

script:
- vendor/bin/phpunit
- vendor/bin/phpunit
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
],
"minimum-stability": "stable",
"require": {
"php": ">=5.6,<8.0-DEV"
"php": ">=7.4",
"composer-plugin-api": "^1.0.0 || ^2.0.0"
},
"require-dev": {
"composer/composer": "~1.1",
"phpunit/phpunit": "~5.3",
"etsy/phpunit-extensions": "0.7.*"
"composer/composer": "^2",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's this for?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah this is mostly for step debugging, see purple box here: https://getcomposer.org/doc/articles/plugins.md#plugin-package

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are you sure you're not after
"composer-plugin-api": "^1.0.0 || ^2.0.0"
or just v2?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah need to add this, the composer thing is for debugging, so want to keep as dev requirement.

"phpunit/phpunit": "^9"
},
"scripts": {
"post-package-install": [
Expand Down
37 changes: 19 additions & 18 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
bootstrap="./vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
Expand All @@ -9,26 +9,27 @@
stopOnFailure="false"
processIsolation="false"
backupGlobals="false"
syntaxCheck="true"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
>
<coverage includeUncoveredFiles="true">
<include>
<directory suffix=".php">./src</directory>
</include>
<exclude>
<directory>./vendor</directory>
<directory>./tests</directory>
<directory>./template</directory>
<directory>./bin</directory>
</exclude>
<report>
<clover outputFile="./clover.xml"/>
<text outputFile="php://stdout" showUncoveredFiles="false"/>
</report>
</coverage>
<testsuites>
<testsuite name="Tests">
<directory>./tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist addUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./src</directory>
<exclude>
<directory>./vendor</directory>
<directory>./tests</directory>
<directory>./template</directory>
<directory>./bin</directory>
</exclude>
</whitelist>
</filter>
<logging>
<log type="coverage-text" target="php://stdout" showUncoveredFiles="false"/>
<log type="coverage-clover" target="./clover.xml"/>
</logging>
</phpunit>
<logging/>
</phpunit>
17 changes: 17 additions & 0 deletions tests/CustomAssertionsTrait.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

namespace Jenko\Sunscreen\Tests;

trait CustomAssertionsTrait
{
public static function assertStringMatchIgnoreWhitespace( string $expecting, string $actual )
{
$expected = preg_replace('#\&. #', '', implode(' ', preg_split('/\s+/', trim($expecting))));
$actual = preg_replace('#\&. #', '', implode(' ', preg_split('/\s+/', trim($actual))));

return self::assertEquals(
$expected,
$actual
);
}
}
5 changes: 3 additions & 2 deletions tests/Guesser/AbstractClassGuesserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
use Composer\Package\Package;
use Jenko\Sunscreen\Guesser\AbstractClassGuesser;
use Jenko\Sunscreen\Util;
use PHPUnit\Framework\TestCase;

class AbstractClassGuesserTest extends \PHPUnit_Framework_TestCase
class AbstractClassGuesserTest extends TestCase
{
/**
* @dataProvider getAutoloadsAndExpectedClasses
Expand All @@ -33,4 +34,4 @@ public function getAutoloadsAndExpectedClasses()
[['psr-9999' => ['Foo\\Bar\\' => 'foo/bar/src/']], []],
];
}
}
}
5 changes: 3 additions & 2 deletions tests/Guesser/InterfaceClassGuesserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
use Composer\Package\Package;
use Jenko\Sunscreen\Guesser\InterfaceGuesser;
use Jenko\Sunscreen\Util;
use PHPUnit\Framework\TestCase;

class InterfaceGuesserTest extends \PHPUnit_Framework_TestCase
class InterfaceGuesserTest extends TestCase
{
/**
* @dataProvider getAutoloadsAndExpectedClasses
Expand All @@ -33,4 +34,4 @@ public function getAutoloadsAndExpectedClasses()
[['psr-9999' => ['Foo\\Bar\\' => 'foo/bar/src/']], []],
];
}
}
}
8 changes: 6 additions & 2 deletions tests/Processor/AdapterMethodsProcessorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@
namespace Jenko\Sunscreen\Tests\Processor;

use Jenko\Sunscreen\Processor\AdapterMethodsProcessor;
use Jenko\Sunscreen\Tests\CustomAssertionsTrait;
use Jenko\Sunscreen\Tests\Fixtures\Foo;
use PHPUnit\Framework\TestCase;

class AdapterMethodsProcessorTest extends \PHPUnit_Framework_TestCase
class AdapterMethodsProcessorTest extends TestCase
{
use CustomAssertionsTrait;

/**
* @dataProvider getMethodsAndExpectedStrings
* @param array $methods
Expand All @@ -16,7 +20,7 @@ public function testProcessGeneratesExpectedMethodsString($methods, $expectedMet
{
$processor = new AdapterMethodsProcessor($methods, 'myInterface');

\PHPUnit_Extensions_Assert_More::assertStringMatchIgnoreWhitespace(
self::assertStringMatchIgnoreWhitespace(
$expectedMethodsString,
$processor->process(true)
);
Expand Down
8 changes: 6 additions & 2 deletions tests/Processor/AdapterProcessorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@
namespace Jenko\Sunscreen\Tests\Processor;

use Jenko\Sunscreen\Processor\AdapterProcessor;
use Jenko\Sunscreen\Tests\CustomAssertionsTrait;
use Jenko\Sunscreen\Util;
use PHPUnit\Framework\TestCase;

class AdapterProcessorTest extends \PHPUnit_Framework_TestCase
class AdapterProcessorTest extends TestCase
{
use CustomAssertionsTrait;

/**
* @dataProvider getInterfaceAndExpectedStrings
*
Expand All @@ -20,7 +24,7 @@ public function testProcessGeneratesExpectedAdapterString($interfaceFqn, $expect

$processor = new AdapterProcessor($interfaceFqn, $namespace, $fileLocation);

\PHPUnit_Extensions_Assert_More::assertStringMatchIgnoreWhitespace($expectedAdapterString, $processor->process(true));
self::assertStringMatchIgnoreWhitespace($expectedAdapterString, $processor->process(true));
}

public function getInterfaceAndExpectedStrings()
Expand Down
8 changes: 6 additions & 2 deletions tests/Processor/ClassProcessorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@
namespace Jenko\Sunscreen\Tests\Processor;

use Jenko\Sunscreen\Processor\ClassProcessor;
use Jenko\Sunscreen\Tests\CustomAssertionsTrait;
use Jenko\Sunscreen\Util;
use PHPUnit\Framework\TestCase;

class ClassProcessorTest extends \PHPUnit_Framework_TestCase
class ClassProcessorTest extends TestCase
{
use CustomAssertionsTrait;

/**
* @dataProvider getClassAndExpectedStrings
*
Expand All @@ -20,7 +24,7 @@ public function testProcessGeneratesExpectedClassString($classFqn, $expectedClas

$processor = new ClassProcessor($classFqn, $namespace, $fileLocation);

\PHPUnit_Extensions_Assert_More::assertStringMatchIgnoreWhitespace(
self::assertStringMatchIgnoreWhitespace(
$expectedClassString,
$processor->process(true)
);
Expand Down
8 changes: 6 additions & 2 deletions tests/Processor/InterfaceMethodsProcessorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@
namespace Jenko\Sunscreen\Tests\Processor;

use Jenko\Sunscreen\Processor\InterfaceMethodsProcessor;
use Jenko\Sunscreen\Tests\CustomAssertionsTrait;
use PHPUnit\Framework\TestCase;

class InterfaceMethodsProcessorTest extends \PHPUnit_Framework_TestCase
class InterfaceMethodsProcessorTest extends TestCase
{
use CustomAssertionsTrait;

/**
* @dataProvider getMethodsAndExpectedStrings
* @param array $methods
Expand All @@ -15,7 +19,7 @@ public function testProcessGeneratesExpectedMethodsString($methods, $expectedMet
{
$processor = new InterfaceMethodsProcessor($methods);

\PHPUnit_Extensions_Assert_More::assertStringMatchIgnoreWhitespace(
self::assertStringMatchIgnoreWhitespace(
$expectedMethodsString,
$processor->process(true)
);
Expand Down
8 changes: 6 additions & 2 deletions tests/Processor/InterfaceProcessorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@
namespace Jenko\Sunscreen\Tests\Processor;

use Jenko\Sunscreen\Processor\InterfaceProcessor;
use Jenko\Sunscreen\Tests\CustomAssertionsTrait;
use Jenko\Sunscreen\Util;
use PHPUnit\Framework\TestCase;

class InterfaceProcessorTest extends \PHPUnit_Framework_TestCase
class InterfaceProcessorTest extends TestCase
{
use CustomAssertionsTrait;

/**
* @dataProvider getInterfaceAndExpectedStrings
*
Expand All @@ -20,7 +24,7 @@ public function testProcessGeneratesExpectedInterfaceString($interfaceFqn, $expe

$processor = new InterfaceProcessor($interfaceFqn, $namespace, $fileLocation);

\PHPUnit_Extensions_Assert_More::assertStringMatchIgnoreWhitespace(
self::assertStringMatchIgnoreWhitespace(
$expectedClassString,
$processor->process(true)
);
Expand Down
5 changes: 3 additions & 2 deletions tests/UtilTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@

use Composer\Package\Package;
use Jenko\Sunscreen\Util;
use PHPUnit\Framework\TestCase;

class UtilTest extends \PHPUnit_Framework_TestCase
class UtilTest extends TestCase
{
/**
* @dataProvider getAutoloadsAndExpectedNamespaces
Expand Down Expand Up @@ -77,4 +78,4 @@ public function getInterfaceFqnAndExpectedClassName()
['Jenko\Sunscreen\Tests\Fixtures\BazInterface', 'JenkoBaz']
];
}
}
}