@@ -45,12 +45,13 @@ public function testParseAndBuild(): void
4545# Edit this file to introduce tasks to be run by cron.
4646
4747*/2 * * * * test argument
48+
4849TEXT ;
4950
5051 $ crontab = new Crontab (false );
5152 $ crontab ->parse ($ content );
5253 $ lines = $ crontab ->getLines ();
53- self ::assertCount (3 , $ lines );
54+ self ::assertCount (4 , $ lines );
5455 self ::assertInstanceOf (CommentLine::class, $ lines [0 ]);
5556 self ::assertInstanceOf (BlankLine::class, $ lines [1 ]);
5657 self ::assertInstanceOf (CronJobLine::class, $ lines [2 ]);
@@ -78,6 +79,7 @@ public function testParseAndBuildWithLeading(): void
7879# Edit this file to introduce tasks to be run by cron.
7980
8081*/2 * * * * test argument
82+
8183TEXT ;
8284 self ::assertEquals ($ expected , $ crontab ->build ());
8385 }
@@ -88,12 +90,13 @@ public function testParseAndBuildSystemCrontab(): void
8890# Edit this file to introduce tasks to be run by cron.
8991
9092*/2 * * * * root test argument
93+
9194TEXT ;
9295
9396 $ crontab = new Crontab ();
9497 $ crontab ->parse ($ content );
9598 $ lines = $ crontab ->getLines ();
96- self ::assertCount (3 , $ lines );
99+ self ::assertCount (4 , $ lines );
97100 self ::assertInstanceOf (CommentLine::class, $ lines [0 ]);
98101 self ::assertInstanceOf (BlankLine::class, $ lines [1 ]);
99102 self ::assertInstanceOf (CronJobLine::class, $ lines [2 ]);
@@ -124,6 +127,7 @@ public function testParseAndBuildRealExample(): void
12412752 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
12512852 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
126129#
130+
127131TEXT ;
128132
129133 $ crontab = new Crontab ();
@@ -137,6 +141,7 @@ public function testAddLine(): void
137141# Edit this file to introduce tasks to be run by cron.
138142
139143*/2 * * * * test argument
144+
140145TEXT ;
141146
142147 $ crontab = new Crontab (false );
@@ -153,6 +158,7 @@ public function testRemove(): void
153158 $ content = <<<TEXT
154159# Edit this file to introduce tasks to be run by cron.
155160*/2 * * * * test argument
161+
156162TEXT ;
157163
158164 $ crontab = new Crontab (false );
@@ -171,6 +177,7 @@ public function testRemoveWhere(): void
171177 $ content = <<<TEXT
172178# Edit this file to introduce tasks to be run by cron.
173179*/2 * * * * test argument
180+
174181TEXT ;
175182
176183 $ crontab = new Crontab (false );
@@ -188,4 +195,10 @@ public function testRemoveWhere(): void
188195
189196 self ::assertEquals ($ content , $ crontab ->build ());
190197 }
198+
199+ public function testBuildShouldAppendABlankLine (): void
200+ {
201+ $ crontab = new Crontab ();
202+ self ::assertEquals ("\n" , $ crontab ->build ());
203+ }
191204}
0 commit comments