From b0aced120b1bab0d3a9df5f6ad87df2abc24c8f8 Mon Sep 17 00:00:00 2001 From: Lukas Rosenstock Date: Mon, 1 Oct 2018 18:22:26 +0200 Subject: [PATCH] Fixed and re-enabled test cases --- tests/ClassValidatorTest.php | 20 +++----------------- tests/fixtures/class1.php | 9 +++++++++ tests/fixtures/class2.php | 10 ++++++++++ tests/fixtures/controller1.php | 16 ---------------- tests/fixtures/controller2.php | 17 ----------------- tests/fixtures/provider1.php | 11 ----------- 6 files changed, 22 insertions(+), 61 deletions(-) create mode 100644 tests/fixtures/class1.php create mode 100644 tests/fixtures/class2.php delete mode 100644 tests/fixtures/controller1.php delete mode 100644 tests/fixtures/controller2.php delete mode 100644 tests/fixtures/provider1.php diff --git a/tests/ClassValidatorTest.php b/tests/ClassValidatorTest.php index 9cca5d0..c2c8aad 100644 --- a/tests/ClassValidatorTest.php +++ b/tests/ClassValidatorTest.php @@ -14,27 +14,13 @@ protected function setUp() { $this->validator = new ClassValidator; } - public function testValidateAsController() { - $this->validator->validateAsController($this->loadFromFile('controller1.php')); - } - - public function testValidateControllerAsProvider() { - $this->expectException(Exceptions\PhpMAEException::class); - $this->validator->validateAsProvider($this->loadFromFile('controller1.php')); - } - - public function testValidateAsProvider() { - $this->validator->validateAsProvider($this->loadFromFile('provider1.php')); - } - - public function testValidateProviderAsController() { - $this->expectException(Exceptions\PhpMAEException::class); - $this->validator->validateAsController($this->loadFromFile('provider1.php')); + public function testValidate() { + $this->validator->validate($this->loadFromFile('class1.php')); } public function testNonWhitelistedClass() { $this->expectException(\PHPSandbox\Error::class); - $this->validator->validateAsController($this->loadFromFile('controller2.php')); + $this->validator->validate($this->loadFromFile('class2.php')); } } \ No newline at end of file diff --git a/tests/fixtures/class1.php b/tests/fixtures/class1.php new file mode 100644 index 0000000..1c4aeb0 --- /dev/null +++ b/tests/fixtures/class1.php @@ -0,0 +1,9 @@ +get('/', function() { - return "Hello World!"; - }); - - return $controllers; - } -} \ No newline at end of file diff --git a/tests/fixtures/controller2.php b/tests/fixtures/controller2.php deleted file mode 100644 index 356e4f9..0000000 --- a/tests/fixtures/controller2.php +++ /dev/null @@ -1,17 +0,0 @@ -get('/', function() { - $x = new ClassValidator; - return "Hello World!"; - }); - - return $controllers; - } -} \ No newline at end of file diff --git a/tests/fixtures/provider1.php b/tests/fixtures/provider1.php deleted file mode 100644 index 5cf261d..0000000 --- a/tests/fixtures/provider1.php +++ /dev/null @@ -1,11 +0,0 @@ -