@@ -15,7 +15,7 @@ class TaskManifestTest extends TestCase
15
15
public function list_returns_existing_manifest ()
16
16
{
17
17
$ this ->fakeProject ([
18
- 'shift-tasks.php ' => '<?php return ["task-name" => "fqcn"]; ' ,
18
+ 'shift-tasks.php ' => '<?php return ["namespace" => "Shift", "tasks" => [" task-name" => "fqcn"] ]; ' ,
19
19
]);
20
20
21
21
$ taskManifest = new TaskManifest ($ this ->currentSnapshotPath (), []);
@@ -32,6 +32,42 @@ public function list_returns_default_tasks_for_no_manifest()
32
32
33
33
$ this ->assertSame (['task-name ' => 'Fully \\Qualified \\Class \\Name ' ], $ taskManifest ->list ());
34
34
$ this ->assertFileExists ($ this ->currentSnapshotPath () . DIRECTORY_SEPARATOR . 'shift-tasks.php ' );
35
+
36
+ $ manifest = require $ this ->currentSnapshotPath () . DIRECTORY_SEPARATOR . 'shift-tasks.php ' ;
37
+ $ this ->assertSame ('Shift ' , $ manifest ['namespace ' ]);
38
+ $ this ->assertArrayHasKey ('tasks ' , $ manifest );
39
+ }
40
+
41
+ #[Test]
42
+ public function list_rebuilds_stale_manifest ()
43
+ {
44
+ $ this ->fakeProject ([
45
+ 'shift-tasks.php ' => '<?php return ["namespace" => "Stale", "tasks" => ["task-name" => "foo"]]; ' ,
46
+ 'composer/installed.json ' => json_encode ([
47
+ 'packages ' => [
48
+ [
49
+ 'extra ' => [
50
+ 'shift ' => [
51
+ 'tasks ' => ['task1 ' => '\\Package \\Task1 ' , 'task2 ' => '\\Package \\Task2 ' ],
52
+ ],
53
+ ],
54
+ ],
55
+ ],
56
+ ]),
57
+ ]);
58
+
59
+ $ taskManifest = new TaskManifest ($ this ->currentSnapshotPath (), ['task-name ' => 'Fully \\Qualified \\Class \\Name ' ]);
60
+
61
+ $ this ->assertEqualsCanonicalizing (
62
+ ['task-name ' => 'Fully \\Qualified \\Class \\Name ' , 'task1 ' => '\\Package \\Task1 ' , 'task2 ' => '\\Package \\Task2 ' ],
63
+ $ taskManifest ->list ()
64
+ );
65
+
66
+ $ this ->assertFileExists ($ this ->currentSnapshotPath () . DIRECTORY_SEPARATOR . 'shift-tasks.php ' );
67
+
68
+ $ manifest = require $ this ->currentSnapshotPath () . DIRECTORY_SEPARATOR . 'shift-tasks.php ' ;
69
+ $ this ->assertSame ('Shift ' , $ manifest ['namespace ' ]);
70
+ $ this ->assertArrayHasKey ('tasks ' , $ manifest );
35
71
}
36
72
37
73
#[Test]
@@ -66,5 +102,9 @@ public function build_returns_merged_tasks_from_packages()
66
102
);
67
103
68
104
$ this ->assertFileExists ($ this ->currentSnapshotPath () . DIRECTORY_SEPARATOR . 'shift-tasks.php ' );
105
+
106
+ $ manifest = require $ this ->currentSnapshotPath () . DIRECTORY_SEPARATOR . 'shift-tasks.php ' ;
107
+ $ this ->assertSame ('Shift ' , $ manifest ['namespace ' ]);
108
+ $ this ->assertArrayHasKey ('tasks ' , $ manifest );
69
109
}
70
110
}
0 commit comments