@@ -25,52 +25,13 @@ protected function setUp() {
2525 */
2626 private function createData ()
2727 {
28-
29- // Create an image in the tmp directory where Upchuck is expecting it
30- $ tmp_dir = ini_get ('upload_tmp_dir ' ) ?: sys_get_temp_dir ();
31- $ img_name = 'decoy-article-image.png ' ;
32- $ img_path = $ tmp_dir .'/ ' .$ img_name ;
33- if (!file_exists ($ img_path )) {
34- $ img = imagecreatetruecolor (20 , 20 );
35- imagepng ($ img , $ img_path );
36- imagedestroy ($ img );
37- }
38-
39- // Make the file record
40- $ file = new UploadedFile (
41- $ img_path ,
42- $ img_name ,
43- 'image/png ' ,
44- null ,
45- null ,
46- true
47- );
48-
4928 return [
50-
51- // Params
52- [
53- 'title ' => 'Example Title ' ,
54- 'body ' => 'Body ' ,
55- 'category ' => 'first ' ,
56- 'date ' => '2020-01-01 ' ,
57- 'featured ' => 1 ,
58- 'public ' => 1 ,
59- 'images ' => [
60- '_xxxx ' => [
61- 'name ' => '' ,
62- ],
63- ],
64- ],
65-
66- // Files
67- [
68- 'images ' => [
69- '_xxxx ' => [
70- 'file ' => $ file ,
71- ],
72- ],
73- ],
29+ 'title ' => 'Example Title ' ,
30+ 'body ' => 'Body ' ,
31+ 'category ' => 'first ' ,
32+ 'date ' => '2020-01-01 ' ,
33+ 'featured ' => 1 ,
34+ 'public ' => 1 ,
7435 ];
7536 }
7637
@@ -106,18 +67,15 @@ public function testStoreFailsValidation()
10667 */
10768 public function testStore ()
10869 {
109- list ($ params , $ files ) = $ this ->createData ();
110-
111- $ response = $ this ->call ('POST ' , 'admin/articles/create ' , array_merge ($ params , [
70+ $ response = $ this ->call ('POST ' , 'admin/articles/create ' , array_merge ($ this ->createData (), [
11271 '_save ' => 'save ' ,
113- ]), [], $ files );
72+ ]));
11473
11574 $ this ->assertRedirectedTo ('admin/articles/1/edit ' );
11675
11776 $ article = Article::findBySlug ('example-title ' );
11877 $ this ->assertNotEmpty ($ article );
11978 $ this ->assertEquals (1 , $ article ->position );
120- $ this ->assertNotEmpty ($ article ->img ()->url );
12179 }
12280
12381 /**
0 commit comments