phpunit

install:

composer global require phpunit/phpunit

file: bin/test_run

# esegue tutti i test (file xTest.php) nella dir specificata
phpunit --colors --bootstrap=tests/bootstrap.php tests/
 
# fa girare un solo test
phpunit --colors Stack

file: tests/$dir/StackTest.php

<?php
// non servono include
class StackTest extends PHPUnit_Framework_TestCase {
    public function 
testPushAndPop() {
        
$stack = array();
        
$this->assertEquals(0count($stack));
    }
}

file: bootstrap.php

<?php
defined
('APPLICATION_PATH') || define('APPLICATION_PATH'realpath(dirname(__FILE__) . '/../application'));
// Define application environment
defined('APPLICATION_ENV') || define('APPLICATION_ENV''testing' );
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
    
realpath(APPLICATION_PATH '/../library'),
    
get_include_path(),
)));
require_once 
'Zend/Loader/Autoloader.php';
Zend_Loader_Autoloader::getInstance();
# generare test
phpunit-skelgen

codeception


Notice: Undefined variable: browserName in /var/www/taziomirandola.it/lib/Visitors.php on line 86

Notice: Undefined variable: browserName in /var/www/taziomirandola.it/lib/Visitors.php on line 96

Deprecated: strripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in /var/www/taziomirandola.it/lib/Visitors.php on line 96

Notice: Undefined index: HTTP_ACCEPT_LANGUAGE in /var/www/taziomirandola.it/lib/Visitors.php on line 39

Fatal error: Uncaught TypeError: Argument 1 passed to safe_text() must be of the type string, null given, called in /var/www/taziomirandola.it/lib/Visitors.php on line 39 and defined in /var/www/taziomirandola.it/lib/Visitors.php:162 Stack trace: #0 /var/www/taziomirandola.it/lib/Visitors.php(39): safe_text() #1 /var/www/taziomirandola.it/lib/Visitors.php(124): Visitors::getData() #2 [internal function]: Visitors::log() #3 {main} thrown in /var/www/taziomirandola.it/lib/Visitors.php on line 162