Skip to content

Instantly share code, notes, and snippets.

@marcw
Last active December 21, 2015 20:59
Show Gist options
  • Save marcw/6365444 to your computer and use it in GitHub Desktop.
Save marcw/6365444 to your computer and use it in GitHub Desktop.
<?php
namespace Redacted\Tests;
/**
* @author Marc Weistroff <[email protected]>
*/
class FuckedUpTest extends \PHPUnit_Framework_TestCase
{
public function testThatIsExpected()
{
call_user_func(array('Doctrine\ORM\EntityManager', 'create'), null);
}
public function testThatIsFuckedUp()
{
// look! Orm is not ORM and PHP Namespaces are case-insensitive.
// As Doctrine\Orm\EntityManager won't be found anywhere, PHPUnit will define that class
// When you will want to use Doctrine\ORM\EntityManager, the class created by PHPUnit will be used
// thus creating a mind-boggling bug.
$managerMock = $this->getMockBuilder('Doctrine\Orm\EntityManager')
->disableOriginalConstructor()
->getMock();
call_user_func(array('Doctrine\ORM\EntityManager', 'create'), null);
}
public function testThisIsReallyFuckedUp()
{
call_user_func(array('Doctrine\ORM\EntityManager', 'create'), null);
}
}
PHPUnit 3.7.14 by Sebastian Bergmann.
Configuration read from [redacted]/app/phpunit.xml.dist
EEE
Time: 0 seconds, Memory: 3.75Mb
There were 3 errors:
1) [redacted]\FuckedUpTest::testThatIsExpected
Argument 2 passed to Doctrine\ORM\EntityManager::create() must be an instance of Doctrine\ORM\Configuration, none given
[redacted]/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php:843
[redacted]/Tests/FuckedUpTest.php:14
2) [redacted]\FuckedUpTest::testThatIsFuckedUp
Argument 2 passed to Doctrine\ORM\EntityManager::create() must be an instance of Doctrine\ORM\Configuration, none given
[redacted]/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php:843
[redacted]/Tests/FuckedUpTest.php:23
3) [redacted]FuckedUpTest::testThisIsReallyFuckedUp
Argument 2 passed to Doctrine\ORM\EntityManager::create() must be an instance of Doctrine\ORM\Configuration, none given
[redacted]/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php:843
[redacted]/Tests/FuckedUpTest.php:28
FAILURES!
Tests: 3, Assertions: 0, Errors: 3.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment