This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require __DIR__ . '/classes/autoloader.php'; | |
use mageekguy\atoum; | |
$rootData = array('name' => 'atoum', 'children' => array()); | |
$tokenFilter = function($token) { | |
if (is_array($token) === true) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
To known how to use it, just do `php scripts/treemap.php --help`. | |
By default, there is no analyzer defined, so to add them, create a configuration file and add in it:` | |
``` | |
<?php | |
use mageekguy\atoum\scripts\treemap\analyzers; | |
$script | |
->addAnalyzer(new analyzers\token()) | |
->addAnalyzer(new analyzers\size()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use | |
mageekguy\atoum\scripts\treemap, | |
mageekguy\atoum\scripts\treemap\analyzers, | |
mageekguy\atoum\scripts\treemap\categorizer | |
; | |
class commit implements treemap\analyzer | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
command! -buffer -range=% -nargs=? SpaceToTab execute '<line1>,<line2>s#^\( \{'.(<q-args> ? <q-args> : &ts).'\}\)\+#\=repeat("\t", len(submatch(0))/' . &ts . ')#e' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class foo implements iteratorAggregate { function getIterator() {} } | |
$timeClassImplements = 0; | |
for ($i = 0; $i < 1000; $i++) | |
{ | |
$start = microtime(true); | |
class_implements('foo'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Sample atoum configuration file to have code coverage in html format and the treemap. | |
Do "php path/to/test/file -c path/to/this/file" or "php path/to/atoum/scripts/runner.php -c path/to/this/file -f path/to/test/file" to use it. | |
*/ | |
use \mageekguy\atoum; | |
// HTML |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17> rm -f tests/units/classes/foo.php && php scripts/runner.php -f tests/units/classes/foo.php | |
> PHP path: /usr/local/bin/php | |
> PHP version: | |
=> PHP 5.4.13 (cli) (built: Apr 5 2013 08:55:20) | |
=> Copyright (c) 1997-2013 The PHP Group | |
=> Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies | |
> mageekguy\atoum\tests\units\foo... | |
[E___________________________________________________________][1/1] | |
=> Test duration: 0.00 second. | |
=> Memory usage: 0.00 Mb. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60> rm -f tests/units/classes/foo.php && rm -f classes/foo.php && php scripts/runner.php -f tests/units/classes/foo.php | |
> PHP path: /usr/local/bin/php | |
> PHP version: | |
=> PHP 5.4.13 (cli) (built: Apr 5 2013 08:55:20) | |
=> Copyright (c) 1997-2013 The PHP Group | |
=> Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies | |
> mageekguy\atoum\tests\units\foo... | |
[0___________________________________________________________][1/1] | |
=> Test duration: 0.00 second. | |
=> Memory usage: 0.00 Mb. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$file = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'atoum.' . md5(__FILE__); | |
if (is_file($file) === false || filemtime(__FILE__) > filemtime($file)) | |
{ | |
file_put_contents($file, substr(file_get_contents(__FILE__), __COMPILER_HALT_OFFSET__ + 1)); | |
} | |
require $file; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class dotFilter extends \recursiveFilterIterator | |
{ | |
public function accept() | |
{ | |
return (substr($this->getInnerIterator()->current(), 0, 1) != '.'); | |
} | |
} |