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

Commit da039ee

Browse files
committed
Update zend-servicemanager constraints and reduce overall dependencies
- Updates zend-servicemanager constraints to reference `^2.7.5` and `^3.0.3`. - Removes the dependency on zend-config by refactoring tests to test against `ArrayObject`. Since the implementations were only checking for `Traversable` instances and casting them, this is a reasonable substitution. - Modifies the PHP dependency to `^5.5 || ^7.0`. - Updates the dev-develop branch alias to 2.6-dev; after this refactor, it stays backwards compatible with v2.
1 parent a79045b commit da039ee

File tree

6 files changed

+66
-48
lines changed

6 files changed

+66
-48
lines changed

.travis.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,21 @@ matrix:
1919
- EXECUTE_CS_CHECK=true
2020
- php: 5.5
2121
env:
22-
- SERVICE_MANAGER_VERSION='^2.7.3'
22+
- SERVICE_MANAGER_VERSION='^2.7.5'
2323
- php: 5.6
2424
env:
2525
- EXECUTE_TEST_COVERALLS=true
2626
- php: 5.6
2727
env:
28-
- SERVICE_MANAGER_VERSION='^2.7.3'
28+
- SERVICE_MANAGER_VERSION='^2.7.5'
2929
- php: 7
3030
- php: 7
3131
env:
32-
- SERVICE_MANAGER_VERSION='^2.7.3'
32+
- SERVICE_MANAGER_VERSION='^2.7.5'
3333
- php: hhvm
3434
- php: hhvm
3535
env:
36-
- SERVICE_MANAGER_VERSION='^2.7.3'
36+
- SERVICE_MANAGER_VERSION='^2.7.5'
3737
allow_failures:
3838
- php: hhvm
3939

@@ -46,7 +46,7 @@ before_install:
4646
- composer self-update
4747
- if [[ $EXECUTE_TEST_COVERALLS == 'true' ]]; then composer require --dev --no-update satooshi/php-coveralls ; fi
4848
- if [[ $SERVICE_MANAGER_VERSION != '' ]]; then composer require --dev --no-update "zendframework/zend-servicemanager:$SERVICE_MANAGER_VERSION" ; fi
49-
- if [[ $SERVICE_MANAGER_VERSION == '' ]]; then composer require --dev --no-update "zendframework/zend-servicemanager:^3.0" ; fi
49+
- if [[ $SERVICE_MANAGER_VERSION == '' ]]; then composer require --dev --no-update "zendframework/zend-servicemanager:^3.0.3" ; fi
5050

5151
install:
5252
- travis_retry composer install --no-interaction --ignore-platform-reqs

composer.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,12 @@
1313
}
1414
},
1515
"require": {
16-
"php": ">=5.5",
17-
"zendframework/zend-escaper": "~2.5",
16+
"php": "^5.5 || ^7.0",
17+
"zendframework/zend-escaper": "^2.5",
1818
"zendframework/zend-stdlib": "^3.0"
1919
},
2020
"require-dev": {
21-
"zendframework/zend-config": "dev-develop as 2.6.0",
22-
"zendframework/zend-servicemanager": "^2.7.4 || ^3.0.3",
21+
"zendframework/zend-servicemanager": "^2.7.5 || ^3.0.3",
2322
"fabpot/php-cs-fixer": "1.7.*",
2423
"phpunit/PHPUnit": "~4.0"
2524
},
@@ -31,7 +30,7 @@
3130
"extra": {
3231
"branch-alias": {
3332
"dev-master": "2.5-dev",
34-
"dev-develop": "3.0-dev"
33+
"dev-develop": "2.6-dev"
3534
}
3635
},
3736
"autoload-dev": {

test/Cloud/CloudTest.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
namespace ZendTest\Tag\Cloud;
1111

12+
use ArrayObject;
1213
use stdClass;
1314
use Zend\ServiceManager\ServiceManager;
1415
use Zend\ServiceManager\Config as SMConfig;
@@ -229,9 +230,14 @@ public function testConstructorWithArray()
229230
$this->assertEquals('foo', $list[0]->getTitle());
230231
}
231232

233+
/**
234+
* This test uses ArrayObject, which will have essentially the
235+
* same behavior as Zend\Config\Config; the code is looking only
236+
* for a Traversable.
237+
*/
232238
public function testConstructorWithConfig()
233239
{
234-
$cloud = $this->getCloud(new \Zend\Config\Config([
240+
$cloud = $this->getCloud(new ArrayObject([
235241
'tags' => [
236242
[
237243
'title' => 'foo',

test/Cloud/Decorator/HtmlCloudTest.php

Lines changed: 32 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
namespace ZendTest\Tag\Cloud\Decorator;
1111

12+
use ArrayObject;
1213
use Zend\Tag\Cloud\Decorator;
1314

1415
/**
@@ -72,58 +73,54 @@ public function testSeparator()
7273
public function testConstructorWithArray()
7374
{
7475
$decorator = new Decorator\HtmlCloud([
75-
'htmlTags' => ['div'],
76-
'separator' => ' '
77-
]);
76+
'htmlTags' => ['div'],
77+
'separator' => ' ',
78+
]);
7879

7980
$this->assertEquals(
80-
'<div>foo bar</div>', $decorator->render(
81-
[
82-
'foo',
83-
'bar'
84-
]
85-
)
81+
'<div>foo bar</div>',
82+
$decorator->render([
83+
'foo',
84+
'bar'
85+
])
8686
);
8787
}
8888

89+
/**
90+
* This test uses ArrayObject, which will have essentially the
91+
* same behavior as Zend\Config\Config; the code is looking only
92+
* for a Traversable.
93+
*/
8994
public function testConstructorWithConfig()
9095
{
91-
$decorator = new Decorator\HtmlCloud(
92-
new \Zend\Config\Config(
93-
[
94-
'htmlTags' => ['div'],
95-
'separator' => ' '
96-
]
97-
)
98-
);
96+
$decorator = new Decorator\HtmlCloud(new ArrayObject([
97+
'htmlTags' => ['div'],
98+
'separator' => ' '
99+
]));
99100

100101
$this->assertEquals(
101-
'<div>foo bar</div>', $decorator->render(
102-
[
103-
'foo',
104-
'bar'
105-
]
106-
)
102+
'<div>foo bar</div>',
103+
$decorator->render([
104+
'foo',
105+
'bar'
106+
])
107107
);
108108
}
109109

110110
public function testSetOptions()
111111
{
112112
$decorator = new Decorator\HtmlCloud();
113-
$decorator->setOptions(
114-
[
115-
'htmlTags' => ['div'],
116-
'separator' => ' '
117-
]
118-
);
113+
$decorator->setOptions([
114+
'htmlTags' => ['div'],
115+
'separator' => ' '
116+
]);
119117

120118
$this->assertEquals(
121-
'<div>foo bar</div>', $decorator->render(
122-
[
123-
'foo',
124-
'bar'
125-
]
126-
)
119+
'<div>foo bar</div>',
120+
$decorator->render([
121+
'foo',
122+
'bar'
123+
])
127124
);
128125
}
129126

test/Cloud/Decorator/HtmlTagTest.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
namespace ZendTest\Tag\Cloud\Decorator;
1111

12+
use ArrayObject;
1213
use Zend\Tag;
1314
use Zend\Tag\Cloud\Decorator;
1415

@@ -114,9 +115,18 @@ public function testConstructorWithArray()
114115
$this->assertEquals('pt', $decorator->getFontSizeUnit());
115116
}
116117

118+
/**
119+
* This test uses ArrayObject, which will have essentially the
120+
* same behavior as Zend\Config\Config; the code is looking only
121+
* for a Traversable.
122+
*/
117123
public function testConstructorWithConfig()
118124
{
119-
$decorator = new Decorator\HtmlTag(new \Zend\Config\Config(['minFontSize' => 5, 'maxFontSize' => 10, 'fontSizeUnit' => 'pt']));
125+
$decorator = new Decorator\HtmlTag(new ArrayObject([
126+
'minFontSize' => 5,
127+
'maxFontSize' => 10,
128+
'fontSizeUnit' => 'pt',
129+
]));
120130

121131
$this->assertEquals(5, $decorator->getMinFontSize());
122132
$this->assertEquals(10, $decorator->getMaxFontSize());

test/ItemTest.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
namespace ZendTest\Tag;
1111

12+
use ArrayObject;
1213
use Zend\Tag;
1314

1415
/**
@@ -108,9 +109,14 @@ public function testMissingWeight()
108109
$tag = new Tag\Item(['title' => 'foo']);
109110
}
110111

112+
/**
113+
* This test uses ArrayObject, which will have essentially the
114+
* same behavior as Zend\Config\Config; the code is looking only
115+
* for a Traversable.
116+
*/
111117
public function testConfigOptions()
112118
{
113-
$tag = new Tag\Item(new \Zend\Config\Config(['title' => 'foo', 'weight' => 1]));
119+
$tag = new Tag\Item(new ArrayObject(['title' => 'foo', 'weight' => 1]));
114120

115121
$this->assertEquals($tag->getTitle(), 'foo');
116122
$this->assertEquals($tag->getWeight(), 1);

0 commit comments

Comments
 (0)