From 69e2eda8dbf1c7f049dddb8f05e72ca89391be10 Mon Sep 17 00:00:00 2001 From: Timothy Clem Date: Tue, 20 Mar 2018 16:46:32 -0700 Subject: [PATCH] Couple more tests --- test/Analysis/PHP/Spec.hs | 12 ++++++++++-- test/fixtures/php/analysis/bar.php | 4 ++++ test/fixtures/php/analysis/main.php | 2 ++ test/fixtures/php/analysis/main_once.php | 6 ++++++ 4 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 test/fixtures/php/analysis/bar.php create mode 100644 test/fixtures/php/analysis/main_once.php diff --git a/test/Analysis/PHP/Spec.hs b/test/Analysis/PHP/Spec.hs index 39368a7a2..1094af671 100644 --- a/test/Analysis/PHP/Spec.hs +++ b/test/Analysis/PHP/Spec.hs @@ -10,9 +10,16 @@ import SpecHelpers spec :: Spec spec = parallel $ do describe "evalutes PHP" $ do - it "include" $ do + it "include and require" $ do env <- evaluate "main.php" - let expectedEnv = [ (qualifiedName ["foo"], addr 0) ] + let expectedEnv = [ (qualifiedName ["foo"], addr 0) + , (qualifiedName ["bar"], addr 1) ] + env `shouldBe` expectedEnv + + it "include_once and require_once" $ do + env <- evaluate "main_once.php" + let expectedEnv = [ (qualifiedName ["foo"], addr 0) + , (qualifiedName ["bar"], addr 1) ] env `shouldBe` expectedEnv where @@ -22,4 +29,5 @@ spec = parallel $ do evaluateFiles phpParser [ fixtures <> entry , fixtures <> "foo.php" + , fixtures <> "bar.php" ] diff --git a/test/fixtures/php/analysis/bar.php b/test/fixtures/php/analysis/bar.php new file mode 100644 index 000000000..03e99baf3 --- /dev/null +++ b/test/fixtures/php/analysis/bar.php @@ -0,0 +1,4 @@ +