-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathModule.php
More file actions
92 lines (82 loc) · 3.04 KB
/
Module.php
File metadata and controls
92 lines (82 loc) · 3.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?php
/**
* ZF2 Phpunit Runner
*
* @link https://github.com/waltzofpearls/zf2-phpunit-runner for the canonical source repository
* @copyright Copyright (c) 2014 Topbass Labs (topbasslabs.com)
* @author Waltz.of.Pearls <rollie@topbasslabs.com, rollie.ma@gmail.com>
*/
namespace PhpunitRunner;
use Zend\Mvc\MvcEvent;
use Zend\ModuleManager\Feature\ConsoleBannerProviderInterface;
use Zend\ModuleManager\Feature\ConsoleUsageProviderInterface;
use Zend\Console\Adapter\AdapterInterface as Console;
class Module implements ConsoleBannerProviderInterface, ConsoleUsageProviderInterface
{
public function onBootstrap(MvcEvent $e)
{
}
public function getConsoleBanner(Console $console)
{
// ASCII art generator: http://patorjk.com/software/taag/
return <<<ASCII_WORD_ART
___________ ___. .____ ___.
\__ ___/___ ______\_ |__ _____ ______ ______ | | _____ \_ |__ ______
| | / _ \\____ \| __ \\__ \ / ___// ___/ | | \__ \ | __ \ / ___/
| |( <_> ) |_> > \_\ \/ __ \_\___ \ \___ \ | |___ / __ \| \_\ \\___ \
|____| \____/| __/|___ (____ /____ >____ > |_______ (____ /___ /____ >
|__| \/ \/ \/ \/ \/ \/ \/ \/
ASCII_WORD_ART;
}
public function getConsoleUsage(Console $console)
{
return array(
// Unit testing
'Run unit test suites with PHPUnit:',
'test [all|db|app] [--module=] [-verbose|-v]' => 'Run unit test suites.',
array('--module=MODULE', 'Name of the module(s) that is(are) going to be tested. Single or multiple values are both accept (e.g. --module=PhpunitRunner). [all] is the default option'),
// Common options
'Common options:',
array('--verbose|-v', 'Turn on verbose output.'),
array('--help|-h', 'Print this menu.'),
);
}
public function getConfig()
{
return $this->includeConfig('module', true);
}
public function getAutoloaderConfig()
{
return array(
'Zend\Loader\ClassMapAutoloader' => array(
__DIR__ . '/autoload_classmap.php',
),
'Zend\Loader\StandardAutoloader' => array(
'namespaces' => array(
__NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
),
),
);
}
public function getBundleConfig()
{
return $this->includeConfig('bundle', false);
}
protected function includeConfig($file, $required = false)
{
$file = __DIR__ . '/config/' . $file . '.config.php';
if (file_exists($file)) {
return include $file;
} else {
if ($required) {
throw new RuntimeException(sprintf(
'Required config file [%s] does not exist for module [%s].',
$file,
__NAMESPACE__
));
} else {
return array();
}
}
}
}