@@ -26,8 +26,8 @@ public function testSetup()
26
26
$ app ->invoke ("norelease " );
27
27
$ app ->invoke ("deploy:setup " );
28
28
29
- $ this ->assertFileExists ($ app ->env ->deploy_to ."/.git " );
30
29
ob_end_clean ();
30
+ $ this ->assertFileExists ($ app ->env ->deploy_to ."/.git " );
31
31
}
32
32
33
33
public function testUpdateCode ()
@@ -51,9 +51,9 @@ public function testUpdateCode()
51
51
$ app ->invoke ("deploy:update " );
52
52
$ new_sha = shell_exec ("cd {$ app ->env ->release_dir } && {$ app ->env ->scm ->revision ()}" );
53
53
54
+ ob_end_clean ();
54
55
$ this ->assertFileExists ($ app ->env ->release_dir );
55
56
$ this ->assertTrue ($ sha == $ new_sha );
56
- ob_end_clean ();
57
57
}
58
58
59
59
public function testDeployBranch ()
@@ -72,20 +72,24 @@ public function testDeployBranch()
72
72
73
73
$ app ->env ->branch = "gh-pages " ;
74
74
$ app ->invoke ("deploy:update " );
75
+ sleep (1 );
75
76
$ app ->reset ();
76
- $ current_branch = shell_exec ("cd {$ app ->env ->release_dir } && git rev-parse --abbrev-ref HEAD " );
77
+ $ expected_sha = $ app ->env ->scm ->get_commit_sha ($ app ->env ->branch );
78
+ $ current_sha = shell_exec ("cd {$ app ->env ->release_dir } && {$ app ->env ->scm ->revision ()}" );
77
79
80
+ ob_end_clean ();
78
81
$ this ->assertFileExists ($ app ->env ->release_dir );
79
- $ this ->assertSame ($ app -> env -> branch , trim ($ current_branch ));
82
+ $ this ->assertSame ($ expected_sha , trim ($ current_sha ));
80
83
84
+ ob_start ();
81
85
$ app ->env ->branch = "" ;
82
86
$ app ->env ->revision = "0.3.5 " ;
83
87
$ app ->invoke ("deploy:update " );
84
88
85
- $ sha = shell_exec ("cd {$ app ->env ->release_dir } && git log --pretty=format:'%H' -n 1 " );
86
- $ this ->assertSame ($ sha , "46bbf9cfe5cfa3656f1246870ff98656e27761e7 " );
89
+ $ sha = shell_exec ("cd {$ app ->env ->release_dir } && {$ app ->env ->scm ->revision ()}" );
87
90
88
91
ob_end_clean ();
92
+ $ this ->assertSame (trim ($ sha ), "46bbf9cfe5cfa3656f1246870ff98656e27761e7 " );
89
93
}
90
94
91
95
public function testFinalize ()
@@ -105,10 +109,10 @@ public function testFinalize()
105
109
$ app ->invoke ("deploy:update " );
106
110
$ app ->invoke ("deploy:finalize " );
107
111
112
+ ob_end_clean ();
108
113
$ this ->assertFileExists ($ app ->env ->current_dir );
109
114
$ this ->assertTrue (is_link ($ app ->env ->current_dir ));
110
115
$ this ->assertTrue (readlink ($ app ->env ->current_dir ) == $ app ->env ->release_dir );
111
- ob_end_clean ();
112
116
}
113
117
114
118
public function testCleanUp ()
@@ -134,9 +138,9 @@ public function testCleanUp()
134
138
$ app ->invoke ("deploy:update " );
135
139
$ app ->invoke ("deploy:cleanup " );
136
140
141
+ ob_end_clean ();
137
142
$ this ->assertFileExists ($ app ->env ->release_dir );
138
143
$ this ->assertCount (2 , glob ($ app ->env ->releases_dir ."/* " ));
139
- ob_end_clean ();
140
144
}
141
145
142
146
public function testCold ()
@@ -154,6 +158,7 @@ public function testCold()
154
158
155
159
$ app ->invoke ("deploy:cold " );
156
160
161
+ ob_end_clean ();
157
162
$ this ->assertFileExists ($ app ->env ->release_dir );
158
163
$ this ->assertFileExists ($ app ->env ->releases_dir );
159
164
$ this ->assertFileExists ($ app ->env ->shared_dir );
@@ -163,8 +168,6 @@ public function testCold()
163
168
$ this ->assertFileExists ($ app ->env ->current_dir );
164
169
$ this ->assertTrue (is_link ($ app ->env ->current_dir ));
165
170
$ this ->assertTrue (readlink ($ app ->env ->current_dir ) == $ app ->env ->release_dir );
166
-
167
- ob_end_clean ();
168
171
}
169
172
170
173
public function testDefault ()
@@ -183,11 +186,10 @@ public function testDefault()
183
186
184
187
$ app ->invoke ("deploy " );
185
188
189
+ ob_end_clean ();
186
190
$ this ->assertFileExists ($ app ->env ->current_dir );
187
191
$ this ->assertTrue (is_link ($ app ->env ->current_dir ));
188
192
$ this ->assertTrue (readlink ($ app ->env ->current_dir ) == $ app ->env ->release_dir );
189
-
190
- ob_end_clean ();
191
193
}
192
194
193
195
public function testRollback ()
@@ -216,12 +218,11 @@ public function testRollback()
216
218
217
219
$ release = readlink ($ app ->env ->current_dir );
218
220
221
+ ob_end_clean ();
219
222
$ this ->assertFileExists ($ app ->env ->current_dir );
220
223
$ this ->assertTrue (is_link ($ app ->env ->current_dir ));
221
224
$ this ->assertFileExists ($ release );
222
225
$ this ->assertFalse (readlink ($ app ->env ->current_dir ) == $ app ->env ->release_dir );
223
-
224
- ob_end_clean ();
225
226
}
226
227
227
228
// private
0 commit comments