Skip to content
This repository was archived by the owner on Feb 6, 2020. It is now read-only.

Commit aaec79c

Browse files
committed
Renamed CliTool to ConfigDumper
- To better describe what it does.
1 parent 1db4334 commit aaec79c

File tree

3 files changed

+22
-22
lines changed

3 files changed

+22
-22
lines changed

bin/dump-config.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
}
3737

3838
try {
39-
$config = Tool\CliTool::createDependencyConfig($appConfig, $className);
39+
$config = Tool\ConfigDumper::createDependencyConfig($appConfig, $className);
4040
} catch (Exception\InvalidArgumentException $e) {
4141
fwrite(STDERR, sprintf(
4242
'Unable to create config for "%s": %s%s',
@@ -46,5 +46,5 @@
4646
));
4747
exit(1);
4848
}
49-
echo Tool\CliTool::dumpConfigFile($config);
49+
echo Tool\ConfigDumper::dumpConfigFile($config);
5050
exit(0);

src/Tool/CliTool.php renamed to src/Tool/ConfigDumper.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515
use Zend\ServiceManager\AbstractFactory\ConfigAbstractFactory;
1616
use Zend\ServiceManager\Exception\InvalidArgumentException;
1717

18-
class CliTool
18+
class ConfigDumper
1919
{
2020
const CONFIG_TEMPLATE = <<<EOC
2121
<?php
2222
/**
23-
* This file generated by Zend\ServiceManager\Tool\CliTool.
23+
* This file generated by Zend\ServiceManager\Tool\ConfigDumper.
2424
* Generated %s
2525
*/
2626

test/Tool/CliToolTest.php renamed to test/Tool/ConfigDumperTest.php

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,33 +13,33 @@
1313
use PHPUnit_Framework_TestCase as TestCase;
1414
use Zend\ServiceManager\AbstractFactory\ConfigAbstractFactory;
1515
use Zend\ServiceManager\Exception\InvalidArgumentException;
16-
use Zend\ServiceManager\Tool\CliTool;
16+
use Zend\ServiceManager\Tool\ConfigDumper;
1717
use ZendTest\ServiceManager\TestAsset\FailingFactory;
1818
use ZendTest\ServiceManager\TestAsset\InvokableObject;
1919
use ZendTest\ServiceManager\TestAsset\ObjectWithScalarDependency;
2020
use ZendTest\ServiceManager\TestAsset\SecondComplexDependencyObject;
2121
use ZendTest\ServiceManager\TestAsset\SimpleDependencyObject;
2222

23-
class CliToolTest extends TestCase
23+
class ConfigDumperTest extends TestCase
2424
{
2525
public function testCreateDependencyConfigExceptsIfClassNameIsNotString()
2626
{
2727
self::expectException(InvalidArgumentException::class);
2828
self::expectExceptionMessage('Class name must be a string, integer given');
29-
CliTool::createDependencyConfig([], 42);
29+
ConfigDumper::createDependencyConfig([], 42);
3030
}
3131

3232
public function testCreateDependencyConfigExceptsIfClassDoesNotExist()
3333
{
3434
$className = 'Dirk\Gentley\Holistic\Detective\Agency';
3535
self::expectException(InvalidArgumentException::class);
3636
self::expectExceptionMessage('Cannot find class with name ' . $className);
37-
CliTool::createDependencyConfig([], $className);
37+
ConfigDumper::createDependencyConfig([], $className);
3838
}
3939

4040
public function testCreateDependencyConfigInvokableObjectReturnsEmptyArray()
4141
{
42-
$config = CliTool::createDependencyConfig([], InvokableObject::class);
42+
$config = ConfigDumper::createDependencyConfig([], InvokableObject::class);
4343
self::assertEquals(
4444
[
4545
ConfigAbstractFactory::class => [
@@ -52,7 +52,7 @@ public function testCreateDependencyConfigInvokableObjectReturnsEmptyArray()
5252

5353
public function testCreateDependencyConfigSimpleDependencyReturnsCorrectly()
5454
{
55-
$config = CliTool::createDependencyConfig([], SimpleDependencyObject::class);
55+
$config = ConfigDumper::createDependencyConfig([], SimpleDependencyObject::class);
5656
self::assertEquals(
5757
[
5858
ConfigAbstractFactory::class => [
@@ -69,7 +69,7 @@ public function testCreateDependencyConfigSimpleDependencyReturnsCorrectly()
6969

7070
public function testCreateDependencyConfigClassWithoutConstructorChangesNothing()
7171
{
72-
$config = CliTool::createDependencyConfig([ConfigAbstractFactory::class => []], FailingFactory::class);
72+
$config = ConfigDumper::createDependencyConfig([ConfigAbstractFactory::class => []], FailingFactory::class);
7373
self::assertEquals([ConfigAbstractFactory::class => []], $config);
7474
}
7575

@@ -79,7 +79,7 @@ public function testCreateDependencyConfigWithoutTypeHintedParameterExcepts()
7979
self::expectExceptionMessage(
8080
'Cannot create config for ' . ObjectWithScalarDependency::class . ', it has no type hints in constructor'
8181
);
82-
$config = CliTool::createDependencyConfig(
82+
$config = ConfigDumper::createDependencyConfig(
8383
[ConfigAbstractFactory::class => []],
8484
ObjectWithScalarDependency::class
8585
);
@@ -89,15 +89,15 @@ public function testCreateFactoryMappingsExceptsIfClassNameIsNotString()
8989
{
9090
self::expectException(InvalidArgumentException::class);
9191
self::expectExceptionMessage('Class name must be a string, integer given');
92-
CliTool::createFactoryMappings([], 42);
92+
ConfigDumper::createFactoryMappings([], 42);
9393
}
9494

9595
public function testCreateFactoryMappingsExceptsIfClassDoesNotExist()
9696
{
9797
$className = 'Dirk\Gentley\Holistic\Detective\Agency';
9898
self::expectException(InvalidArgumentException::class);
9999
self::expectExceptionMessage('Cannot find class with name ' . $className);
100-
CliTool::createFactoryMappings([], $className);
100+
ConfigDumper::createFactoryMappings([], $className);
101101
}
102102

103103
public function testCreateFactoryMappingsReturnsUnmodifiedArrayIfMappingExists()
@@ -109,7 +109,7 @@ public function testCreateFactoryMappingsReturnsUnmodifiedArrayIfMappingExists()
109109
],
110110
],
111111
];
112-
self::assertEquals($config, CliTool::createFactoryMappings($config, InvokableObject::class));
112+
self::assertEquals($config, ConfigDumper::createFactoryMappings($config, InvokableObject::class));
113113
}
114114

115115
public function testCreateFactoryMappingsAddsClassIfNotExists()
@@ -121,7 +121,7 @@ public function testCreateFactoryMappingsAddsClassIfNotExists()
121121
],
122122
],
123123
];
124-
self::assertEquals($expectedConfig, CliTool::createFactoryMappings([], InvokableObject::class));
124+
self::assertEquals($expectedConfig, ConfigDumper::createFactoryMappings([], InvokableObject::class));
125125
}
126126

127127
public function testCreateFactoryMappingsIgnoresExistingsMappings()
@@ -133,12 +133,12 @@ public function testCreateFactoryMappingsIgnoresExistingsMappings()
133133
],
134134
],
135135
];
136-
self::assertEquals($config, CliTool::createFactoryMappings($config, InvokableObject::class));
136+
self::assertEquals($config, ConfigDumper::createFactoryMappings($config, InvokableObject::class));
137137
}
138138

139139
public function testCreateFactoryMappingsFromConfigReturnsIfNoConfigKey()
140140
{
141-
self::assertEquals([], CliTool::createFactoryMappingsFromConfig([]));
141+
self::assertEquals([], ConfigDumper::createFactoryMappingsFromConfig([]));
142142
}
143143

144144
public function testCreateFactoryMappingsFromConfigExceptsWhenConfigNotArray()
@@ -148,7 +148,7 @@ public function testCreateFactoryMappingsFromConfigExceptsWhenConfigNotArray()
148148
'Config key for ' . ConfigAbstractFactory::class . ' should be an array, boolean given'
149149
);
150150

151-
CliTool::createFactoryMappingsFromConfig(
151+
ConfigDumper::createFactoryMappingsFromConfig(
152152
[
153153
ConfigAbstractFactory::class => true,
154154
]
@@ -188,17 +188,17 @@ public function testCreateFactoryMappingsFromConfigWithWorkingConfig()
188188
],
189189
];
190190

191-
self::assertEquals($expectedConfig, CliTool::createFactoryMappingsFromConfig($config));
191+
self::assertEquals($expectedConfig, ConfigDumper::createFactoryMappingsFromConfig($config));
192192
}
193193

194194
/**
195195
* @depends testCreateDependencyConfigSimpleDependencyReturnsCorrectly
196196
*/
197197
public function testDumpConfigFileReturnsContentsForConfigFileUsingUsingClassNotationAndShortArrays(array $config)
198198
{
199-
$formatted = CliTool::dumpConfigFile($config);
199+
$formatted = ConfigDumper::dumpConfigFile($config);
200200
$this->assertContains(
201-
'<' . "?php\n/**\n * This file generated by Zend\ServiceManager\Tool\CliTool.\n",
201+
'<' . "?php\n/**\n * This file generated by Zend\ServiceManager\Tool\ConfigDumper.\n",
202202
$formatted
203203
);
204204

0 commit comments

Comments
 (0)