Skip to content

Commit 6c9fdae

Browse files
author
Vyacheslav Gulyam
committed
functional tests added
1 parent be366c4 commit 6c9fdae

File tree

7 files changed

+112
-33
lines changed

7 files changed

+112
-33
lines changed

tests/before/Functions.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
4+
function functionA($argumentVar) {
5+
$localVarA = 3;
6+
return $argumentVar + $localVarA;
7+
}
8+
9+
function functionB() {
10+
$localVarB = 5;
11+
return functionB($localVarB);
12+
}
13+
14+
$localVarMainA = "local value";
15+
$localVarMainB = functionB();
16+
$localVarMainA = functionA($localVarMainA);

tests/before/MultipleClasses.php

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php
2+
3+
class FirstClass {
4+
5+
protected $_protectedProperty;
6+
public $publicProperty;
7+
8+
protected function _protectedMethod() {
9+
echo "This is protected method of first class";
10+
}
11+
12+
public function publicMethod() {
13+
echo "This is public method of first class";
14+
}
15+
}
16+
17+
class SecondClass extends FirstClass {
18+
19+
private $_privateProperty;
20+
21+
protected function _protectedMethod() {
22+
parent::_protectedMethod();
23+
echo "This is protected method of second class";
24+
$this->_privateProperty = parent::$_protectedProperty;
25+
}
26+
27+
public function publicMethod() {
28+
parent::publicMethod();
29+
echo "This is public method of second class";
30+
$this->_privateProperty = parent::$publicProperty;
31+
}
32+
}
33+
34+
class ThirdClass {
35+
public function __construct(SecondClass $secondObject) {
36+
$secondObject->publicMethod();
37+
}
38+
}

tests/before/Namespaces.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
namespace namespaceA;
4+
5+
class classA {
6+
7+
}
8+
9+
namespace namespaceB;
10+
11+
use namespaceA;
12+
13+
class classB {
14+
private $_objectA;
15+
16+
public function __construct() {
17+
$this->_objectA = new namespaceA\classA();
18+
}
19+
}

tests/before/SimpleClass.php

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
1-
<?php
2-
3-
class SimpleClass {
4-
5-
private $_privateProperty;
6-
protected $_protectedProperty;
7-
public $publicProperty;
8-
9-
private function _privateMethod() {
10-
$localVar = "test";
11-
$this->_privateProperty = $localVar;
12-
$this->_protectedProperty = $localVar;
13-
$this->publicProperty = $localVar;
14-
}
15-
16-
protected function _protectedMethod() {
17-
$localVar = "test";
18-
$this->_privateProperty = $localVar;
19-
$this->_protectedProperty = $localVar;
20-
$this->publicProperty = $localVar;
21-
}
22-
23-
public function publicMethod() {
24-
$localVar = "test";
25-
$this->_privateProperty = $localVar;
26-
$this->_protectedProperty = $localVar;
27-
$this->publicProperty = $localVar;
28-
$this->_protectedMethod();
29-
$this->_privateMethod();
30-
}
31-
}
32-
33-
$simpleObject = new SimpleClass();
1+
<?php
2+
3+
class SimpleClass {
4+
5+
private $_privateProperty;
6+
protected $_protectedProperty;
7+
public $publicProperty;
8+
9+
private function _privateMethod() {
10+
$localVar = "test";
11+
$this->_privateProperty = $localVar;
12+
$this->_protectedProperty = $localVar;
13+
$this->publicProperty = $localVar;
14+
}
15+
16+
protected function _protectedMethod() {
17+
$localVar = "test";
18+
$this->_privateProperty = $localVar;
19+
$this->_protectedProperty = $localVar;
20+
$this->publicProperty = $localVar;
21+
}
22+
23+
public function publicMethod() {
24+
$localVar = "test";
25+
$this->_privateProperty = $localVar;
26+
$this->_protectedProperty = $localVar;
27+
$this->publicProperty = $localVar;
28+
$this->_protectedMethod();
29+
$this->_privateMethod();
30+
}
31+
}
32+
33+
$simpleObject = new SimpleClass();
3434
$simpleObject->publicMethod();

tests/expected/Functions.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<?php
2+
function functionA($spc5a579) { $sp0edd21 = 3; return $spc5a579 + $sp0edd21; } function functionB() { $sp6a6761 = 5; return functionB($sp6a6761); } $sp8851f9 = 'local value'; $sp7f60ff = functionB(); $sp8851f9 = functionA($sp8851f9);

tests/expected/MultipleClasses.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<?php
2+
class FirstClass { protected $_protectedProperty; public $publicProperty; protected function _protectedMethod() { echo 'This is protected method of first class'; } public function publicMethod() { echo 'This is public method of first class'; } } class SecondClass extends FirstClass { private $_privateProperty; protected function _protectedMethod() { parent::_protectedMethod(); echo 'This is protected method of second class'; $this->_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(); } }

tests/expected/Namespaces.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<?php
2+
namespace namespaceA; class classA { } namespace namespaceB; use namespaceA; class classB { private $_objectA; public function __construct() { $this->_objectA = new namespaceA\classA(); } }

0 commit comments

Comments
 (0)