Skip to content

Commit

Permalink
Merge 5871866 into ee05755
Browse files Browse the repository at this point in the history
  • Loading branch information
gennadigennadigennadi committed Oct 3, 2020
2 parents ee05755 + 5871866 commit e6b73a0
Show file tree
Hide file tree
Showing 12 changed files with 58 additions and 50 deletions.
20 changes: 8 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,32 +12,28 @@ env:
matrix:
fast_finish: true
include:
- php: 7.1
- php: 7.3
env:
- DEPS=lowest
- php: 7.1
- php: 7.3
env:
- DEPS=latest
- TEST_COVERAGE=true
- STATIC_ANALYSIS=true
- php: 7.2
env:
- DEPS=lowest
- php: 7.2
env:
- DEPS=latest
- php: 7.3
- php: 7.4
env:
- DEPS=lowest
- php: 7.3
- php: 7.4
env:
- DEPS=latest
- php: 7.4
- php: nightly
env:
- DEPS=lowest
- php: 7.4
- php: nightly
env:
- DEPS=latest
allow_failures:
- php: nightly

before_install:
- if [[ $TEST_COVERAGE != 'true' ]]; then phpenv config-rm xdebug.ini || return 0 ; fi
Expand Down
9 changes: 5 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,20 @@
}
},
"require": {
"php": "^7.1",
"php": "^7.3",
"laminas/laminas-stdlib": "^3.2.1",
"laminas/laminas-zendframework-bridge": "^0.4.5 || ^1.0",
"phpstan/phpstan-shim": "^0.10.5",
"psr/container": "^1.0",
"psr/log": "^1.0"
},
"require-dev": {
"container-interop/container-interop": "^1.2.0",
"laminas/laminas-coding-standard": "~1.0.0",
"laminas/laminas-servicemanager": "^3.0",
"laminas/laminas-servicemanager": "^3.4",
"mikey179/vfsstream": "^1.6.7",
"phpunit/phpunit": "^7.5.18 || ^8.5"
"phpstan/phpstan": "^0.12",
"phpspec/prophecy-phpunit": "^2.0",
"phpunit/phpunit": "^9.3"
},
"conflict": {
"laminas/laminas-servicemanager-di": "*",
Expand Down
46 changes: 20 additions & 26 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,28 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true">
<testsuites>
<testsuite name="laminas-di">
<directory>./test/</directory>
</testsuite>
</testsuites>

<groups>
<exclude>
<group>disable</group>
</exclude>
</groups>

<filter>
<whitelist addUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./src</directory>
</whitelist>
</filter>

<php>
<ini name="date.timezone" value="UTC"/>
<ini name="error_reporting" value="E_ALL"/>
</php>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd" bootstrap="vendor/autoload.php" colors="true">
<coverage includeUncoveredFiles="true">
<include>
<directory suffix=".php">./src</directory>
</include>
</coverage>
<testsuites>
<testsuite name="laminas-di">
<directory>test</directory>
</testsuite>
</testsuites>
<groups>
<exclude>
<group>disable</group>
</exclude>
</groups>
<php>
<ini name="date.timezone" value="UTC"/>
<ini name="error_reporting" value="E_ALL"/>
</php>
</phpunit>
3 changes: 3 additions & 0 deletions test/CodeGenerator/AbstractInjectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
use LaminasTest\Di\TestAsset\InvokableInterface;
use PHPUnit\Framework\TestCase;
use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy;
use Psr\Container\ContainerInterface;
use ReflectionProperty;
Expand All @@ -30,6 +31,8 @@
*/
class AbstractInjectorTest extends TestCase
{
use ProphecyTrait;

/**
* @var InjectorInterface|ObjectProphecy
*/
Expand Down
2 changes: 2 additions & 0 deletions test/CodeGenerator/InjectorGeneratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use LaminasTest\Di\TestAsset;
use PHPUnit\Framework\TestCase;
use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use Psr\Log\LoggerInterface;

/**
Expand All @@ -27,6 +28,7 @@ class InjectorGeneratorTest extends TestCase
const DEFAULT_NAMESPACE = 'LaminasTest\Di\Generated';

use GeneratorTestTrait;
use ProphecyTrait;

public function testGenerateCreatesFiles() : void
{
Expand Down
2 changes: 1 addition & 1 deletion test/Container/ConfigFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public function testLegacyConfigTriggersDeprecationNotice()
],
]);

$this->expectException(DeprecatedError::class);
$this->expectDeprecation(DeprecatedError::class);
(new ConfigFactory())->create($container);
}
}
3 changes: 3 additions & 0 deletions test/GeneratedInjectorDelegatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,14 @@
use Laminas\Di\GeneratedInjectorDelegator;
use Laminas\Di\InjectorInterface;
use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\ContainerInterface;

class GeneratedInjectorDelegatorTest extends TestCase
{
use ProphecyTrait;

public function testProvidedNamespaceIsNotAString()
{
$container = $this->prophesize(ContainerInterface::class);
Expand Down
2 changes: 1 addition & 1 deletion test/LegacyConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function testLegacyConfigMigration(array $config, array $expected)

public function testFQParamNamesTriggerDeprecated()
{
$this->expectException(DeprecatedError::class);
$this->expectDeprecation(DeprecatedError::class);

new LegacyConfig([
'instance' => [
Expand Down
6 changes: 3 additions & 3 deletions test/Resolver/AbstractInjectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ class AbstractInjectionTest extends TestCase
{
public function testUsageIsDeprecated()
{
$this->expectException(Deprecated::class);
$this->expectExceptionMessage(sprintf(
$this->expectDeprecation(Deprecated::class);
$this->expectDeprecationMessage(sprintf(
'%s is deprecated, please migrate to %s',
AbstractInjection::class,
InjectionInterface::class
));

new class() extends AbstractInjection
new class () extends AbstractInjection
{
public function export(): string
{
Expand Down
3 changes: 3 additions & 0 deletions test/Resolver/DependencyResolverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
use Laminas\Di\Resolver\ValueInjection;
use LaminasTest\Di\TestAsset;
use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Psr\Container\ContainerInterface;
use stdClass;

Expand All @@ -33,6 +34,8 @@
*/
class DependencyResolverTest extends TestCase
{
use ProphecyTrait;

/**
* @return PHPUnit_Framework_MockObject_MockObject|ContainerInterface
*/
Expand Down
7 changes: 5 additions & 2 deletions test/Resolver/TypeInjectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Laminas\Di\Resolver\ValueInjection;
use PHPUnit\Framework\Error\Deprecated;
use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Psr\Container\ContainerInterface;
use stdClass;

Expand All @@ -25,6 +26,8 @@
*/
class TypeInjectionTest extends TestCase
{
use ProphecyTrait;

public function testImplementsContract()
{
$this->assertInstanceOf(InjectionInterface::class, new TypeInjection('typename'));
Expand Down Expand Up @@ -55,7 +58,7 @@ public function testExport()
public function provideTypeNames(): iterable
{
return [
'arbitary' => [ 'SomeArbitaryTypeName' ],
'arbitary' => ['SomeArbitaryTypeName'],
];
}

Expand All @@ -70,7 +73,7 @@ public function testIsExportableIsAlwaysTrue($typeName)
public function testGetTypeIsDeprectaed()
{
$subject = new TypeInjection('SomeType');
$this->expectException(Deprecated::class);
$this->expectDeprecation();
$this->assertSame('SomeType', $subject->getType());
}
}
5 changes: 4 additions & 1 deletion test/Resolver/ValueInjectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use PHPUnit\Framework\Error\Deprecated;
use PHPUnit\Framework\TestCase;
use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use Psr\Container\ContainerInterface;
use stdClass;

Expand All @@ -27,6 +28,8 @@
*/
class ValueInjectionTest extends TestCase
{
use ProphecyTrait;

private $streamFixture = null;

protected function setUp(): void
Expand Down Expand Up @@ -182,7 +185,7 @@ public function testGetValueTriggersDeprecatedNotice()
$value = uniqid();
$subject = new ValueInjection($value);

$this->expectException(Deprecated::class);
$this->expectDeprecation(Deprecated::class);
self::assertSame($value, $subject->getValue());
}
}

0 comments on commit e6b73a0

Please sign in to comment.