2018-03-20 00:53:47 +03:00
|
|
|
{-# LANGUAGE OverloadedLists #-}
|
2018-03-20 00:42:00 +03:00
|
|
|
module Analysis.PHP.Spec (spec) where
|
|
|
|
|
|
|
|
import Data.Abstract.Value
|
|
|
|
import Data.Map
|
|
|
|
|
|
|
|
import SpecHelpers
|
|
|
|
|
|
|
|
|
|
|
|
spec :: Spec
|
|
|
|
spec = parallel $ do
|
|
|
|
describe "evalutes PHP" $ do
|
|
|
|
it "include" $ do
|
|
|
|
env <- evaluate "main.php"
|
2018-03-20 00:53:47 +03:00
|
|
|
let expectedEnv = [ (qualifiedName ["foo"], addr 0) ]
|
2018-03-20 00:42:00 +03:00
|
|
|
env `shouldBe` expectedEnv
|
|
|
|
|
|
|
|
where
|
|
|
|
addr = Address . Precise
|
|
|
|
fixtures = "test/fixtures/php/analysis/"
|
|
|
|
evaluate entry = snd . fst . fst . fst . fst <$>
|
|
|
|
evaluateFiles phpParser
|
|
|
|
[ fixtures <> entry
|
|
|
|
, fixtures <> "foo.php"
|
|
|
|
]
|