File tree 2 files changed +26
-7
lines changed
2 files changed +26
-7
lines changed Original file line number Diff line number Diff line change 6
6
7
7
class Environment implements StringInterface
8
8
{
9
- const PRODUCTION = 'production ' ;
10
- const BETA = 'beta ' ;
11
- const STAGE = 'stage ' ;
12
- const DEV = 'dev ' ;
13
- const LOCAL = 'local ' ;
14
- const VAGRANT = 'vagrant ' ;
15
- const DOCKER = 'docker ' ;
9
+ const PRODUCTION = 'production ' ;
10
+ const PRODUCTION_MIGRATION = 'production-migration ' ;
11
+ const BETA = 'beta ' ;
12
+ const STAGE = 'stage ' ;
13
+ const DEV = 'dev ' ;
14
+ const LOCAL = 'local ' ;
15
+ const VAGRANT = 'vagrant ' ;
16
+ const DOCKER = 'docker ' ;
16
17
17
18
/**
18
19
* @var string
@@ -73,6 +74,7 @@ private function isValid($value)
73
74
{
74
75
return in_array ($ value , [
75
76
self ::PRODUCTION ,
77
+ self ::PRODUCTION_MIGRATION ,
76
78
self ::BETA ,
77
79
self ::STAGE ,
78
80
self ::DEV ,
@@ -81,4 +83,16 @@ private function isValid($value)
81
83
self ::DOCKER ,
82
84
]);
83
85
}
86
+
87
+ public function isProductionMigration ()
88
+ {
89
+ return $ this ->value === self ::PRODUCTION_MIGRATION ;
90
+ }
91
+
92
+ public function isProductionEnvironment ()
93
+ {
94
+ return $ this ->isProduction ()
95
+ || $ this ->isBeta ()
96
+ || $ this ->isProductionMigration ();
97
+ }
84
98
}
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ public function testInvalidEnvironment()
16
16
public function testValidEnvironment ()
17
17
{
18
18
$ this ->assertEquals ('production ' , new Environment ('production ' ));
19
+ $ this ->assertEquals ('production-migration ' , new Environment ('production-migration ' ));
19
20
$ this ->assertEquals ('stage ' , new Environment ('stage ' ));
20
21
$ this ->assertEquals ('dev ' , new Environment ('dev ' ));
21
22
$ this ->assertEquals ('local ' , new Environment ('local ' ));
@@ -32,5 +33,9 @@ public function testIsMethods()
32
33
$ this ->assertTrue ((new Environment ('vagrant ' ))->isLocal ());
33
34
$ this ->assertTrue ((new Environment ('beta ' ))->isBeta ());
34
35
$ this ->assertTrue ((new Environment ('docker ' ))->isDocker ());
36
+ $ this ->assertTrue ((new Environment ('production-migration ' ))->isProductionMigration ());
37
+ $ this ->assertTrue ((new Environment ('production-migration ' ))->isProductionEnvironment ());
38
+ $ this ->assertTrue ((new Environment ('production ' ))->isProductionEnvironment ());
39
+ $ this ->assertTrue ((new Environment ('beta ' ))->isProductionEnvironment ());
35
40
}
36
41
}
You can’t perform that action at this time.
0 commit comments