Skip to content

Drop pm v1 #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
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
9 changes: 4 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,17 @@ cache:
- $HOME/.composer/cache

php:
- 5.6
- 7
- 7.1
- 7.2
- 7.3
- 7.4snapshot

env:
- DEPS=lowest
- DEPS=latest

before_install:
- if [[ $DEPS == 'lowest' ]]; then travis_retry composer update --prefer-stable --no-interaction --prefer-lowest ; fi
- if [[ $DEPS == 'latest' ]]; then travis_retry composer update --prefer-stable --no-interaction ; fi
- if [[ $DEPS == 'lowest' ]]; then travis_retry composer update --no-interaction --prefer-lowest ; fi
- if [[ $DEPS == 'latest' ]]; then travis_retry composer update --no-interaction ; fi

script:
- composer test
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@
"name": "snapshotpl/lazy-container",
"description": "Lazy loading PSR-11 container decorator",
"type": "library",
"license": "BSD 3-Clause",
"license": "BSD-3-Clause",
"authors": [
{
"name": "Witold Wasiczko",
"email": "witold@wasiczko.pl"
}
],
"require": {
"php": "^5.6 || ^7.0",
"php": "^7.2",
"psr/container": "^1.0",
"ocramius/proxy-manager": "^1.0 || ^2.0"
"ocramius/proxy-manager": "^2.2.2"
},
"require-dev": {
"phpunit/phpunit": "^5.7.27 || ^6.5.7",
"phpunit/phpunit": "^8.3.3",
"snapshotpl/nano-container": "^1.0",
"container-interop/container-interop": "^1.2.0"
},
Expand Down
2 changes: 1 addition & 1 deletion phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<phpunit bootstrap="./vendor/autoload.php" colors="true">
<testsuites>
<testsuite>
<testsuite name="unit">
<directory>./test</directory>
</testsuite>
</testsuites>
Expand Down
14 changes: 7 additions & 7 deletions test/LazyContainerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class LazyContainerTest extends TestCase
protected $decoratedContainer;
protected $loaded;

protected function setUp()
protected function setUp(): void
{
$this->loaded = null;
$factories = [
Expand All @@ -37,42 +37,42 @@ protected function setUp()
$this->container = new LazyContainer($this->decoratedContainer, $lazyLoadingFactory, $classMap);
}

public function testGetExpectedObjectFromContainer()
public function testGetExpectedObjectFromContainer(): void
{
$result = $this->container->get('foo');

$this->assertInstanceOf(ArrayObject::class, $result);
}

public function testInstanceIsNotCreatedBeforeUsage()
public function testInstanceIsNotCreatedBeforeUsage(): void
{
$this->container->get('foo');

$this->assertFalse($this->isInstanceCreated('foo'));
}

public function testInstanceIsCreatedAfterUsage()
public function testInstanceIsCreatedAfterUsage(): void
{
$this->container->get('foo')->ksort();

$this->assertTrue($this->isInstanceCreated('foo'));
}

public function testInstanceIsCreatedBeforeUsageIfNotMapped()
public function testInstanceIsCreatedBeforeUsageIfNotMapped(): void
{
$this->container->get('bar');

$this->assertTrue($this->isInstanceCreated('bar'));
}

public function testCheckServiceExistsWorksSameAsDecoratedContainer()
public function testCheckServiceExistsWorksSameAsDecoratedContainer(): void
{
$result = $this->container->has('foo');

$this->assertTrue($result);
}

protected function isInstanceCreated($serviceId)
protected function isInstanceCreated(string $serviceId): bool
{
return $this->loaded === $serviceId;
}
Expand Down