Skip to content
This repository was archived by the owner on May 6, 2025. It is now read-only.
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
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
"symfony/expression-language": "^2.7"
},
"require-dev": {
"phpunit/phpunit": "4.8.*"
"phpunit/phpunit": "4.8.*",
"mikey179/vfsStream": "^1.0"
},
"bin": ["bin/deprecation-detector"],
"autoload": {
Expand Down
50 changes: 48 additions & 2 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

52 changes: 52 additions & 0 deletions tests/RuleSet/Loader/DirectoryLoaderTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?php

namespace SensioLabs\DeprecationDetector\Tests\RuleSet\Loader;

use Prophecy\Argument;
use SensioLabs\DeprecationDetector\RuleSet\Loader\DirectoryLoader;
use SensioLabs\DeprecationDetector\RuleSet\RuleSet;

class DirectoryLoaderTest extends \PHPUnit_Framework_TestCase
{
public function testClassIsInitializable()
{
$traverser = $this->prophesize('\SensioLabs\DeprecationDetector\RuleSet\Traverser');
$cache = $this->prophesize('\SensioLabs\DeprecationDetector\RuleSet\Cache');

$loader = new DirectoryLoader($traverser->reveal(), $cache->reveal());

$this->assertInstanceOf('\SensioLabs\DeprecationDetector\RuleSet\Loader\DirectoryLoader', $loader);
}

public function testLoadRuleSetUncached()
{
$traverser = $this->prophesize('\SensioLabs\DeprecationDetector\RuleSet\Traverser');
$traverser->traverse(Argument::any())
->willReturn(new RuleSet());

$cache = $this->prophesize('\SensioLabs\DeprecationDetector\RuleSet\Cache');

$loader = new DirectoryLoader($traverser->reveal(), $cache->reveal());

$actualRuleSet = $loader->loadRuleSet('any');

$this->assertInstanceOf('\SensioLabs\DeprecationDetector\RuleSet\RuleSet', $actualRuleSet);
}

public function testLoadRuleSetCached()
{
$traverser = $this->prophesize('\SensioLabs\DeprecationDetector\RuleSet\Traverser');

$cache = $this->prophesize('\SensioLabs\DeprecationDetector\RuleSet\Cache');
$cache->has(Argument::any())
->willReturn(true);
$cache->getCachedRuleSet(Argument::any())
->willReturn(new RuleSet());

$loader = new DirectoryLoader($traverser->reveal(), $cache->reveal());

$actualRuleSet = $loader->loadRuleSet('any');

$this->assertInstanceOf('\SensioLabs\DeprecationDetector\RuleSet\RuleSet', $actualRuleSet);
}
}