File tree Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,11 @@ class InfoCommand
23
23
*/
24
24
const AVAILABLE_VERSIONS = 'available_versions ' ;
25
25
26
+ /**
27
+ * New versions
28
+ */
29
+ const NEW_VERSIONS = 'new_versions ' ;
30
+
26
31
27
32
/**
28
33
* @var MagentoComposerApplication
@@ -100,6 +105,21 @@ private function extractVersions($packageInfo)
100
105
$ packageInfo [self ::AVAILABLE_VERSIONS ] = array_values (preg_grep ("/^\*.*/ " , $ versions , PREG_GREP_INVERT ));
101
106
}
102
107
108
+ if (count ($ packageInfo [self ::AVAILABLE_VERSIONS ]) > 0 ) {
109
+ if ($ packageInfo [self ::CURRENT_VERSION ]) {
110
+ foreach ($ packageInfo [self ::AVAILABLE_VERSIONS ] as $ version ) {
111
+ if (version_compare ($ packageInfo [self ::CURRENT_VERSION ], $ version , '< ' )) {
112
+ $ packageInfo [self ::NEW_VERSIONS ][] = $ version ;
113
+ }
114
+ }
115
+ $ packageInfo [self ::NEW_VERSIONS ][] = $ packageInfo [self ::CURRENT_VERSION ];
116
+ } else {
117
+ $ packageInfo [self ::NEW_VERSIONS ] = $ packageInfo [self ::AVAILABLE_VERSIONS ];
118
+ }
119
+ } else {
120
+ $ packageInfo [self ::NEW_VERSIONS ] = [];
121
+ }
122
+
103
123
return $ packageInfo ;
104
124
}
105
125
}
Original file line number Diff line number Diff line change @@ -61,7 +61,8 @@ public function testRunInstalled()
61
61
'type ' => 'library ' ,
62
62
'names ' => '3rdp/a ' ,
63
63
'current_version ' => '1.0.0 ' ,
64
- 'available_versions ' => []
64
+ 'available_versions ' => [],
65
+ 'new_versions ' => []
65
66
],
66
67
$ result
67
68
);
@@ -97,6 +98,10 @@ public function getCommandOutputDataProvider()
97
98
'available_versions ' => [
98
99
'1.0.0 ' ,
99
100
'1.1.0 '
101
+ ],
102
+ 'new_versions ' => [
103
+ '1.0.0 ' ,
104
+ '1.1.0 '
100
105
]
101
106
]
102
107
],
@@ -123,6 +128,10 @@ public function getCommandOutputDataProvider()
123
128
'1.0.0 ' ,
124
129
'1.1.0 ' ,
125
130
'1.2.0 '
131
+ ],
132
+ 'new_versions ' => [
133
+ '1.2.0 ' ,
134
+ '1.1.2 '
126
135
]
127
136
]
128
137
],
You can’t perform that action at this time.
0 commit comments