Skip to content

Instantly share code, notes, and snippets.

@basz
Created March 30, 2012 08:36
Show Gist options
  • Save basz/2249755 to your computer and use it in GitHub Desktop.
Save basz/2249755 to your computer and use it in GitHub Desktop.
bootstrap file
<?php
require_once __DIR__ . '/../autoload_register.php';
$rootPath = realpath(dirname(__DIR__));
$testsPath = "$rootPath/tests";
if (is_readable($testsPath . '/TestConfiguration.php')) {
require_once $testsPath . '/TestConfiguration.php';
} else {
require_once $testsPath . '/TestConfiguration.php.dist';
}
$path = array(
$testsPath,
ZEND_FRAMEWORK_PATH,
get_include_path(),
);
set_include_path(implode(PATH_SEPARATOR, $path));
require_once 'Zend/Loader/AutoloaderFactory.php';
\Zend\Loader\AutoloaderFactory::factory(array('Zend\Loader\StandardAutoloader' => array()));
$listenerOptions = new Zend\Module\Listener\ListenerOptions(array('module_paths' => array(__DIR__ . '/..')));
$defaultListeners = new Zend\Module\Listener\DefaultListenerAggregate($listenerOptions);
//$defaultListeners->getConfigListener()->addConfigGlobPath("config/autoload/{module.*,global,$env,local}.config.php");
$moduleManager = new Zend\Module\Manager(array('PhingBundle'));
$moduleManager->events()->attachAggregate($defaultListeners);
$moduleManager->loadModules();
// some more but commented
//....
===============
Problem: phpunit test exits with an error that seem illogical. Complains return value must be string while is IS.
Rattletrap:tests bas$ phpunit
PHPUnit 3.6.10 by Sebastian Bergmann.
Configuration read from /Users/bas/Sandbox/ZendSkeletonApplication/vendor/PhingBundle/tests/phpunit.xml
bool(true)
bool(true)
bool(true)
bool(true)
E
Time: 0 seconds, Memory: 6.00Mb
There was 1 error:
1) PhingBundleTest\ServiceTest::testSomethingThis
Exception: Zend\Stdlib\PriorityQueue::serialize() must return a string or NULL
FAILURES!
Tests: 1, Assertions: 0, Errors: 1.
//////////////////////////////////
namespace PhingBundleTest;
class ServiceTest extends \PHPUnit_Framework_TestCase
{
public function testSomethingThis()
{
$this->assertFalse(true);
}
}
//////////////////////////////////
A modification Zend\Stdlib\PriorityQueue::serialize()
Note the var_dump return true every time...
public function serialize()
{
var_dump(is_string(serialize($this->items)));
return serialize($this->items);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment