Skip to content

Commit

Permalink
Fixed and re-enabled test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
LukasRos committed Oct 1, 2018
1 parent c5503ef commit b0aced1
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 61 deletions.
20 changes: 3 additions & 17 deletions tests/ClassValidatorTest.php
Expand Up @@ -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'));
}

}
9 changes: 9 additions & 0 deletions tests/fixtures/class1.php
@@ -0,0 +1,9 @@
<?php

class TestClass1 {

public function __invoke() {
return "Hello World!";
}

}
10 changes: 10 additions & 0 deletions tests/fixtures/class2.php
@@ -0,0 +1,10 @@
<?php

class TestClass2 {

public function __invoke() {
$x = new ClassValidator;
return "Hello World!";
}

}
16 changes: 0 additions & 16 deletions tests/fixtures/controller1.php

This file was deleted.

17 changes: 0 additions & 17 deletions tests/fixtures/controller2.php

This file was deleted.

11 changes: 0 additions & 11 deletions tests/fixtures/provider1.php

This file was deleted.

0 comments on commit b0aced1

Please sign in to comment.