diff --git a/phpunit.xml b/phpunit.xml new file mode 100644 index 0000000..48e0074 --- /dev/null +++ b/phpunit.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/tests/Base.php b/tests/Base.php new file mode 100644 index 0000000..e8103da --- /dev/null +++ b/tests/Base.php @@ -0,0 +1,7 @@ +fail("{$expectedFileName} not found"); + } + $this->assertEquals(file_get_contents(__DIR__ . self::EXPECTED_PATH . "/" . $expectedFileName), file_get_contents(__DIR__ . self::AFTER_PATH . "/" . $expectedFileName)); + } + } +} \ No newline at end of file diff --git a/tests/before/Functions.php b/tests/before/Functions.php new file mode 100644 index 0000000..9d71efe --- /dev/null +++ b/tests/before/Functions.php @@ -0,0 +1,16 @@ +_privateProperty = parent::$_protectedProperty; + } + + public function publicMethod() { + parent::publicMethod(); + echo "This is public method of second class"; + $this->_privateProperty = parent::$publicProperty; + } +} + +class ThirdClass { + public function __construct(SecondClass $secondObject) { + $secondObject->publicMethod(); + } +} \ No newline at end of file diff --git a/tests/before/Namespaces.php b/tests/before/Namespaces.php new file mode 100644 index 0000000..a0fa731 --- /dev/null +++ b/tests/before/Namespaces.php @@ -0,0 +1,19 @@ +_objectA = new namespaceA\classA(); + } +} \ No newline at end of file diff --git a/tests/before/SimpleClass.php b/tests/before/SimpleClass.php new file mode 100644 index 0000000..e18cb00 --- /dev/null +++ b/tests/before/SimpleClass.php @@ -0,0 +1,34 @@ +_privateProperty = $localVar; + $this->_protectedProperty = $localVar; + $this->publicProperty = $localVar; + } + + protected function _protectedMethod() { + $localVar = "test"; + $this->_privateProperty = $localVar; + $this->_protectedProperty = $localVar; + $this->publicProperty = $localVar; + } + + public function publicMethod() { + $localVar = "test"; + $this->_privateProperty = $localVar; + $this->_protectedProperty = $localVar; + $this->publicProperty = $localVar; + $this->_protectedMethod(); + $this->_privateMethod(); + } +} + +$simpleObject = new SimpleClass(); +$simpleObject->publicMethod(); \ No newline at end of file diff --git a/tests/config.yml b/tests/config.yml new file mode 100644 index 0000000..1fe8f32 --- /dev/null +++ b/tests/config.yml @@ -0,0 +1,7 @@ +services: + + # String scrambler + obfuscator.scrambler: + class: Naneau\Obfuscator\StringScrambler + arguments: + - 'salt' \ No newline at end of file diff --git a/tests/expected/Functions.php b/tests/expected/Functions.php new file mode 100644 index 0000000..638da32 --- /dev/null +++ b/tests/expected/Functions.php @@ -0,0 +1,2 @@ +_privateProperty = parent::$_protectedProperty; } public function publicMethod() { parent::publicMethod(); echo 'This is public method of second class'; $this->_privateProperty = parent::$publicProperty; } } class ThirdClass { public function __construct(SecondClass $spb91639) { $spb91639->publicMethod(); } } \ No newline at end of file diff --git a/tests/expected/Namespaces.php b/tests/expected/Namespaces.php new file mode 100644 index 0000000..3711777 --- /dev/null +++ b/tests/expected/Namespaces.php @@ -0,0 +1,2 @@ +_objectA = new namespaceA\classA(); } } \ No newline at end of file diff --git a/tests/expected/SimpleClass.php b/tests/expected/SimpleClass.php new file mode 100644 index 0000000..8ca200b --- /dev/null +++ b/tests/expected/SimpleClass.php @@ -0,0 +1,2 @@ +_privateProperty = $spd8dce8; $this->_protectedProperty = $spd8dce8; $this->publicProperty = $spd8dce8; } protected function _protectedMethod() { $spd8dce8 = 'test'; $this->_privateProperty = $spd8dce8; $this->_protectedProperty = $spd8dce8; $this->publicProperty = $spd8dce8; } public function publicMethod() { $spd8dce8 = 'test'; $this->_privateProperty = $spd8dce8; $this->_protectedProperty = $spd8dce8; $this->publicProperty = $spd8dce8; $this->_protectedMethod(); $this->sp51fa3f(); } } $sp5de0e2 = new SimpleClass(); $sp5de0e2->publicMethod(); \ No newline at end of file diff --git a/tests/phpunit.php b/tests/phpunit.php new file mode 100644 index 0000000..6515b5c --- /dev/null +++ b/tests/phpunit.php @@ -0,0 +1,9 @@ +