示例#1
0
 public function testSetMinDepthColor()
 {
     $this->if($categorizer = new testedClass(uniqid()))->then->object($categorizer->setMinDepthColor($color = '#000000'))->isIdenticalTo($categorizer)->string($categorizer->getMinDepthColor())->isEqualTo($color)->object($categorizer->setMinDepthColor($color = '000000'))->isIdenticalTo($categorizer)->string($categorizer->getMinDepthColor())->isEqualTo('#' . $color)->object($categorizer->setMinDepthColor($color = '#ffffff'))->isIdenticalTo($categorizer)->string($categorizer->getMinDepthColor())->isEqualTo($color)->object($categorizer->setMinDepthColor($color = 'ffffff'))->isIdenticalTo($categorizer)->string($categorizer->getMinDepthColor())->isEqualTo('#' . $color)->object($categorizer->setMinDepthColor($color = '#FFFFFF'))->isIdenticalTo($categorizer)->string($categorizer->getMinDepthColor())->isEqualTo($color)->object($categorizer->setMinDepthColor($color = 'FFFFFF'))->isIdenticalTo($categorizer)->string($categorizer->getMinDepthColor())->isEqualTo('#' . $color)->exception(function () use($categorizer, &$color) {
         $categorizer->setMinDepthColor('#00000g');
     })->isInstanceOf('mageekguy\\atoum\\exceptions\\logic\\invalidArgument')->hasMessage('Color must be in hexadecimal format')->exception(function () use($categorizer, &$color) {
         $categorizer->setMinDepthColor('#00000');
     })->isInstanceOf('mageekguy\\atoum\\exceptions\\logic\\invalidArgument')->hasMessage('Color must be in hexadecimal format')->exception(function () use($categorizer, &$color) {
         $categorizer->setMinDepthColor('@000000');
     })->isInstanceOf('mageekguy\\atoum\\exceptions\\logic\\invalidArgument')->hasMessage('Color must be in hexadecimal format');
 }
<?php

use mageekguy\atoum\scripts\treemap, mageekguy\atoum\scripts\treemap\analyzers, mageekguy\atoum\scripts\treemap\categorizer;
$script->addAnalyzer(new analyzers\token())->addAnalyzer(new analyzers\size())->addAnalyzer(new analyzers\sloc())->addAnalyzer(new treemap\analyzer\generic('commits', null, function (\splFileInfo $file) {
    $commit = exec('git log --pretty=oneline ' . escapeshellarg($file->getRealpath()) . ' | wc -l');
    return (int) trim($commit);
}));
$testsDirectory = __DIR__ . DIRECTORY_SEPARATOR . 'test' . DIRECTORY_SEPARATOR;
$testsCategorizer = new categorizer('Tests');
$testsCategorizer->setMinDepthColor('#aae6ff')->setMaxDepthColor('#000f50')->setCallback(function ($file) use($testsDirectory) {
    return strpos($file->getRealpath(), $testsDirectory) === 0;
});
$vendorDirectory = __DIR__ . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR;
$vendorCategorizer = new categorizer('Vendor');
$vendorCategorizer->setMinDepthColor('#FFDD99')->setMaxDepthColor('#FFAA00')->setCallback(function ($file) use($vendorDirectory) {
    return strpos($file->getRealpath(), $vendorDirectory) === 0;
});
$codeCategorizer = new categorizer('Code');
$codeCategorizer->setMinDepthColor('#ffaac6')->setMaxDepthColor('#50001b')->setCallback(function ($file) {
    return substr($file->getFilename(), -4) == '.php';
});
$script->addCategorizer($vendorCategorizer)->addCategorizer($testsCategorizer)->addCategorizer($codeCategorizer)->addDirectory(__DIR__)->setProjectName('BFW-controller')->setProjectUrl('http://bfw.bulton.fr')->setOutputDirectory('/home/bubu-blog/www/atoum/bfw-controller/treemap');
示例#3
0
<?php

use mageekguy\atoum\scripts\treemap, mageekguy\atoum\scripts\treemap\analyzers, mageekguy\atoum\scripts\treemap\categorizer;
$script->addAnalyzer(new analyzers\token())->addAnalyzer(new analyzers\size())->addAnalyzer(new analyzers\sloc())->addAnalyzer(new treemap\analyzer\generic('commits', null, function (\splFileInfo $file) {
    $commit = exec('git log --pretty=oneline ' . escapeshellarg($file->getRealpath()) . ' | wc -l');
    return (int) trim($commit);
}));
$testsDirectory = __DIR__ . DIRECTORY_SEPARATOR . 'test' . DIRECTORY_SEPARATOR;
$testsCategorizer = new categorizer('Tests');
$testsCategorizer->setMinDepthColor('#aae6ff')->setMaxDepthColor('#000f50')->setCallback(function ($file) use($testsDirectory) {
    return substr($file->getFilename(), -4) == '.php' && strpos($file->getRealpath(), $testsDirectory) === 0;
});
$codeCategorizer = new categorizer('Code');
$codeCategorizer->setMinDepthColor('#ffaac6')->setMaxDepthColor('#50001b')->setCallback(function ($file) {
    return substr($file->getFilename(), -4) == '.php';
});
$script->addCategorizer($testsCategorizer)->addCategorizer($codeCategorizer)->addDirectory(__DIR__)->setProjectName('BFW')->setProjectUrl('http://bfw.test.bulton.fr')->setOutputDirectory('/home/bfw/www/treemap/bfw-v2');