@@ -64,18 +64,19 @@ public function output_writes_nothing_tree_without_validate_statements()
64
64
65
65
/**
66
66
* @test
67
+ * @dataProvider notificationDraftProvider
67
68
*/
68
- public function output_writes_notifications ()
69
+ public function output_writes_notifications ($ draft )
69
70
{
70
71
$ this ->files ->expects ('stub ' )
71
72
->with ('notification.stub ' )
72
73
->andReturn (file_get_contents ('stubs/notification.stub ' ));
73
74
74
- $ this -> files -> expects ( ' stub ' )
75
- -> with ( ' partials/constructor. stub ' )
76
- -> andReturn ( file_get_contents ( ' stubs/ partials/constructor.stub ' ));
77
-
78
- // var_dump($this->fixture('notifications/review-post.php'));die();
75
+ if ( $ draft === ' drafts/send-statements-notification-facade.yaml ' ) {
76
+ $ this -> files -> expects ( ' stub ' )
77
+ -> with ( ' partials/constructor.stub ' )
78
+ -> andReturn ( file_get_contents ( ' stubs/partials/constructor.stub ' ));
79
+ }
79
80
80
81
$ this ->files ->shouldReceive ('exists ' )
81
82
->twice ()
@@ -95,9 +96,7 @@ public function output_writes_notifications()
95
96
$ this ->files ->expects ('put ' )
96
97
->with ('app/Notification/PublishedPostNotification.php ' , $ this ->fixture ('notifications/published-post.php ' ));
97
98
98
-
99
-
100
- $ tokens = $ this ->blueprint ->parse ($ this ->fixture ('drafts/send-statements-notification.yaml ' ));
99
+ $ tokens = $ this ->blueprint ->parse ($ this ->fixture ($ draft ));
101
100
$ tree = $ this ->blueprint ->analyze ($ tokens );
102
101
103
102
$ this ->assertEquals (['created ' => ['app/Notification/ReviewPostNotification.php ' , 'app/Notification/PublishedPostNotification.php ' ]], $ this ->subject ->output ($ tree ));
@@ -119,7 +118,7 @@ public function it_only_outputs_new_notifications()
119
118
->with ('app/Notification/PublishedPostNotification.php ' )
120
119
->andReturnTrue ();
121
120
122
- $ tokens = $ this ->blueprint ->parse ($ this ->fixture ('drafts/send-statements-notification.yaml ' ));
121
+ $ tokens = $ this ->blueprint ->parse ($ this ->fixture ('drafts/send-statements-notification-facade .yaml ' ));
123
122
$ tree = $ this ->blueprint ->analyze ($ tokens );
124
123
125
124
$ this ->assertEquals ([], $ this ->subject ->output ($ tree ));
@@ -148,9 +147,17 @@ public function it_respects_configuration()
148
147
$ this ->files ->expects ('put ' )
149
148
->with ('src/path/Notification/ReviewNotification.php ' , $ this ->fixture ('notifications/notification-configured.php ' ));
150
149
151
- $ tokens = $ this ->blueprint ->parse ($ this ->fixture ('drafts/readme-example-notification.yaml ' ));
150
+ $ tokens = $ this ->blueprint ->parse ($ this ->fixture ('drafts/readme-example-notification-facade .yaml ' ));
152
151
$ tree = $ this ->blueprint ->analyze ($ tokens );
153
152
154
153
$ this ->assertEquals (['created ' => ['src/path/Notification/ReviewNotification.php ' ]], $ this ->subject ->output ($ tree ));
155
154
}
155
+
156
+ public function notificationDraftProvider ()
157
+ {
158
+ return [
159
+ ['drafts/send-statements-notification-facade.yaml ' ],
160
+ ['drafts/send-statements-notification-model.yaml ' ]
161
+ ];
162
+ }
156
163
}
0 commit comments