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

Autoloader wants to load 'string.php' for assertType('string' since 3.5 #43

Closed
ruflin opened this issue Oct 11, 2010 · 2 comments
Closed

Comments

@ruflin
Copy link

ruflin commented Oct 11, 2010

Hi

Since the update to phpunit 3.5 I receive the following error for the code:

$this->assertType('string', 'Hello world');

Failed opening required 'string.php'

The reason is probably my autoloader. I first hat this problem with the Zend_Framework Autoloader, and then tried my own autoloader:

function test_autoload($class) {
$file = str_replace('_', '/', $class) . '.php';
require_once $file;
}

spl_autoload_register('test_autoload');

The reason that the exception is thrown is because my autoloader is called by the function class_exists in PHPUnit_Framework_Assert. Should I use assertType only for classs and not string, int etc.? Or how should I modify my autoloader? Is this an expected behaviour?

@sebastianbergmann
Copy link
Owner

Please use assertInternalType() instead of assertType() for internal types such as string.

@ruflin
Copy link
Author

ruflin commented Oct 11, 2010

Ok, good to know. I think it would be a good idea to update the documentation, because here the first two examples are string examples:
http://www.phpunit.de/manual/3.5/en/api.html#api.assert.assertType

Thx for your help

This issue was closed.
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

2 participants