@@ -940,25 +940,29 @@ public function testRenderCantFindView()
940940
941941 public function testRenderSavingData ()
942942 {
943- $ parser = new Parser ($ this ->config , $ this ->viewsDir , $ this ->loader );
943+ $ parser = new Parser ($ this ->config , $ this ->viewsDir , $ this ->loader );
944+ $ expected = "<h1>Hello World</h1> \n" ;
945+
944946 $ parser ->setData (['testString ' => 'Hello World ' ]);
947+ $ this ->assertEquals ($ expected , $ parser ->render ('Simpler ' , [], false ));
948+ $ this ->assertArrayNotHasKey ('testString ' , $ parser ->getData ());
945949
946- $ expected = " <h1> Hello World</h1> \n" ;
950+ $ parser -> setData ([ ' testString ' => ' Hello World ' ]) ;
947951 $ this ->assertEquals ($ expected , $ parser ->render ('Simpler ' , [], true ));
948952 $ this ->assertArrayHasKey ('testString ' , $ parser ->getData ());
949- $ this ->assertEquals ($ expected , $ parser ->render ('Simpler ' , [], false ));
950- $ this ->assertArrayNotHasKey ('testString ' , $ parser ->getData ());
951953 }
952954
953955 public function testRenderStringSavingData ()
954956 {
955- $ parser = new Parser ($ this ->config , $ this ->viewsDir , $ this ->loader );
956- $ parser ->setData (['testString ' => 'Hello World ' ]);
957-
957+ $ parser = new Parser ($ this ->config , $ this ->viewsDir , $ this ->loader );
958958 $ expected = '<h1>Hello World</h1> ' ;
959959 $ pattern = '<h1>{testString}</h1> ' ;
960+
961+ $ parser ->setData (['testString ' => 'Hello World ' ]);
960962 $ this ->assertEquals ($ expected , $ parser ->renderString ($ pattern , [], false ));
961963 $ this ->assertArrayNotHasKey ('testString ' , $ parser ->getData ());
964+ //last set data is not saved
965+ $ parser ->setData (['testString ' => 'Hello World ' ]);
962966 $ this ->assertEquals ($ expected , $ parser ->renderString ($ pattern , [], true ));
963967 $ this ->assertArrayHasKey ('testString ' , $ parser ->getData ());
964968 }
0 commit comments