Skip to content
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

DependencyChecker does not works with FileMock #120

Closed
f3l1x opened this issue Jul 5, 2016 · 1 comment
Closed

DependencyChecker does not works with FileMock #120

f3l1x opened this issue Jul 5, 2016 · 1 comment

Comments

@f3l1x
Copy link
Member

f3l1x commented Jul 5, 2016

I have had this code in my tests. It is failing with 2.4.0.

$loader = new ContainerLoader(TEMP_DIR);
$className = $loader->load(function (Compiler $compiler) {
    $compiler->loadConfig(FileMock::create('', 'neon'));
}, 'container');

Nette\InvalidStateException: Unexpected dependency boolean

I think its cause:

// Compiler.php

/**
 * Adds new configuration from file.
 * @return self
 */
public function loadConfig($file)
{
    $loader = new Config\Loader;
    $this->addConfig($loader->load($file));
    $this->dependencies->add($loader->getDependencies());
    return $this;
}
// Loader.php

/**
 * Reads configuration from file.
 * @param  string  file name
 * @param  string  optional section to load
 * @return array
 */
public function load($file, $section = NULL)
{
    if (!is_file($file) || !is_readable($file)) {
        throw new Nette\FileNotFoundException("File '$file' is missing or is not readable.");
    }
    $this->dependencies[] = realpath($file);
       ....
}

realpath(FileMock) == bool(FALSE)


It is maybe issue in nette/tester, but I'm not sure if it is issue at all. What do you think?

@dg dg closed this as completed in 2a02762 Jul 6, 2016
@f3l1x
Copy link
Member Author

f3l1x commented Jul 6, 2016

@dg Thank you.. :-)

PS: I am able to prepare some PR, just tell me next time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant