Imported code from old repository
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace CloudObjects\PhpMAE;
|
||||
|
||||
use ML\IRI\IRI;
|
||||
|
||||
class ClassValidatorTest extends \PHPUnit_Framework_TestCase {
|
||||
|
||||
private $validator;
|
||||
|
||||
private function loadFromFile($filename) {
|
||||
return file_get_contents(__DIR__.'/fixtures/'.$filename);
|
||||
}
|
||||
|
||||
protected function setUp() {
|
||||
$this->validator = new ClassValidator;
|
||||
}
|
||||
|
||||
public function testValidate() {
|
||||
$this->validator->validate($this->loadFromFile('class1.php'),
|
||||
new IRI('coid://example.com/TestClass1'));
|
||||
}
|
||||
|
||||
public function testNonWhitelistedClass() {
|
||||
$this->expectException(\PHPSandbox\Error::class);
|
||||
$this->validator->validate($this->loadFromFile('class2.php'),
|
||||
new IRI('coid://example.com/TestClass2'));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__."/../vendor/autoload.php";
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
class TestClass1 {
|
||||
|
||||
public function __invoke() {
|
||||
return "Hello World!";
|
||||
}
|
||||
|
||||
}
|
||||
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
class TestClass2 {
|
||||
|
||||
public function __invoke() {
|
||||
$x = new ClassValidator;
|
||||
return "Hello World!";
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user