11<?php
22
3- namespace mageekguy \atoum \autoloop ;
3+ namespace mageekguy \atoum \autoloop \ scripts \ runner \ loopers ;
44
55use Lurker \Event \FilesystemEvent ;
66use Lurker \ResourceWatcher ;
7+ use mageekguy \atoum \autoloop \configuration ;
8+ use mageekguy \atoum \scripts \runner ;
9+ use mageekguy \atoum \scripts \runner \looper ;
710
8- class prompt extends \ mageekguy \ atoum \ script \prompt
11+ class watcher implements looper
912{
1013 /**
11- * @var \mageekguy\atoum\runner
14+ * @var configuration
1215 */
13- protected $ runner ;
16+ protected $ configuration ;
1417
1518 /**
16- * @var configuration
19+ * @var runner
1720 */
18- protected $ configuration ;
21+ private $ runner ;
1922
2023 /**
21- * @param string $message
22- *
23- * @return string
24+ * @param runner $runner
2425 */
25- public function ask ( $ message )
26+ public function __construct ( runner $ runner )
2627 {
27- $ runAgainText = "Press <Enter> to reexecute, press any other key and <Enter> to stop... " ;
28- if ($ message != $ runAgainText ) {
29- return parent ::ask ($ message );
30- }
28+ $ this ->runner = $ runner ;
29+ }
3130
31+ /**
32+ * @return string
33+ */
34+ public function runAgain ()
35+ {
3236 /** @var \mageekguy\atoum\writers\std\out $outputWriter */
33- $ outputWriter = $ this ->getOutputWriter ();
37+ $ outputWriter = $ this ->runner -> getOutputWriter ();
3438
3539 $ watcher = new ResourceWatcher ;
3640
@@ -44,7 +48,7 @@ public function ask($message)
4448 $ watcher ->addListener ($ watchedFile , $ onEvent );
4549 }
4650
47- foreach ($ this ->getRunner ()->getTestPaths () as $ path ) {
51+ foreach ($ this ->runner -> getRunner ()->getTestPaths () as $ path ) {
4852 $ watcher ->track ($ path , $ path );
4953 $ watcher ->addListener ($ path , $ onEvent );
5054 }
@@ -56,22 +60,6 @@ public function ask($message)
5660 return '' ;
5761 }
5862
59- /**
60- * @return \mageekguy\atoum\runner
61- */
62- public function getRunner ()
63- {
64- return $ this ->runner ;
65- }
66-
67- /**
68- * @param $runner
69- */
70- public function setRunner ($ runner )
71- {
72- $ this ->runner = $ runner ;
73- }
74-
7563 /**
7664 * @return configuration
7765 */
0 commit comments