Skip to content

Commit

Permalink
No concessions to code quality !
Browse files Browse the repository at this point in the history
  • Loading branch information
hmlb committed Oct 7, 2015
1 parent 5587144 commit 0b631ad
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
1 change: 0 additions & 1 deletion src/HMLB/PHPUnit/Listener/VWListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,3 @@ public function endTestSuite(PHPUnit_Framework_TestSuite $suite)
{
}
}

22 changes: 17 additions & 5 deletions src/HMLB/VW/SecretSoftware.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
namespace HMLB\VW;

use PHPUnit_Framework_TestCase;
use PHPUnit_Framework_TestResult;
use PHPUnit_Runner_BaseTestRunner;
use ReflectionClass;
use ReflectionProperty;

/**
* You didn't see that.
Expand Down Expand Up @@ -85,8 +85,7 @@ public function force(PHPUnit_Framework_TestCase $test)
*/
private function forcePropertyValue(ReflectionClass $reflection, $property, $value, $object)
{
$propertyReflection = $reflection->getProperty($property);
$propertyReflection->setAccessible(true);
$propertyReflection = $this->accessProperty($reflection, $property);
$propertyReflection->setValue($object, $value);
$propertyReflection->setAccessible(false);

Expand All @@ -102,11 +101,24 @@ private function forcePropertyValue(ReflectionClass $reflection, $property, $val
*/
private function getPropertyValue(ReflectionClass $reflection, $property, $object)
{
$propertyReflection = $reflection->getProperty($property);
$propertyReflection->setAccessible(true);
$propertyReflection = $this->accessProperty($reflection, $property);
$value = $propertyReflection->getValue($object);
$propertyReflection->setAccessible(false);

return $value;
}

/**
* @param ReflectionClass $reflection
* @param string $property
*
* @return ReflectionProperty
*/
private function accessProperty(ReflectionClass $reflection, $property)
{
$propertyReflection = $reflection->getProperty($property);
$propertyReflection->setAccessible(true);

return $propertyReflection;
}
}
1 change: 0 additions & 1 deletion src/Tests/VWTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,3 @@ public function testEnvironmentalImpactCompliance()
$this->assertLessThan($this->legalLimit, $this->noxEmissions);
}
}

0 comments on commit 0b631ad

Please sign in to comment.