From dcb88e395b63ac0747b1eb1af5cf3d3e65173efb Mon Sep 17 00:00:00 2001 From: Thomas Müller Date: Fri, 12 Dec 2014 12:34:53 +0100 Subject: rework api of DependencyAnalyzer --- tests/lib/app/dependencyanalyzer.php | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) (limited to 'tests') diff --git a/tests/lib/app/dependencyanalyzer.php b/tests/lib/app/dependencyanalyzer.php index 8443dc5d319..a79995b78b3 100644 --- a/tests/lib/app/dependencyanalyzer.php +++ b/tests/lib/app/dependencyanalyzer.php @@ -15,16 +15,15 @@ use OCP\IL10N; class DependencyAnalyzer extends \PHPUnit_Framework_TestCase { - /** - * @var Platform - */ + /** @var Platform */ private $platformMock; - /** - * @var IL10N - */ + /** @var IL10N */ private $l10nMock; + /** @var \OC\App\DependencyAnalyzer */ + private $analyser; + public function setUp() { $this->platformMock = $this->getMockBuilder('\OC\App\Platform') ->disableOriginalConstructor() @@ -63,6 +62,8 @@ class DependencyAnalyzer extends \PHPUnit_Framework_TestCase { ->will($this->returnCallback(function($text, $parameters = array()) { return vsprintf($text, $parameters); })); + + $this->analyser = new \OC\App\DependencyAnalyzer($this->platformMock, $this->l10nMock); } /** @@ -80,8 +81,7 @@ class DependencyAnalyzer extends \PHPUnit_Framework_TestCase { if (!is_null($maxVersion)) { $app['dependencies']['php']['@attributes']['max-version'] = $maxVersion; } - $analyser = new \OC\App\DependencyAnalyzer($app, $this->platformMock, $this->l10nMock); - $missing = $analyser->analyze(); + $missing = $this->analyser->analyze($app); $this->assertTrue(is_array($missing)); $this->assertEquals($expectedMissing, $missing); @@ -98,8 +98,7 @@ class DependencyAnalyzer extends \PHPUnit_Framework_TestCase { if (!is_null($databases)) { $app['dependencies']['database'] = $databases; } - $analyser = new \OC\App\DependencyAnalyzer($app, $this->platformMock, $this->l10nMock); - $missing = $analyser->analyze(); + $missing = $this->analyser->analyze($app); $this->assertTrue(is_array($missing)); $this->assertEquals($expectedMissing, $missing); @@ -116,8 +115,7 @@ class DependencyAnalyzer extends \PHPUnit_Framework_TestCase { if (!is_null($commands)) { $app['dependencies']['command'] = $commands; } - $analyser = new \OC\App\DependencyAnalyzer($app, $this->platformMock, $this->l10nMock); - $missing = $analyser->analyze(); + $missing = $this->analyser->analyze($app); $this->assertTrue(is_array($missing)); $this->assertEquals($expectedMissing, $missing); @@ -137,8 +135,7 @@ class DependencyAnalyzer extends \PHPUnit_Framework_TestCase { $app['dependencies']['lib'] = $libs; } - $analyser = new \OC\App\DependencyAnalyzer($app, $this->platformMock, $this->l10nMock); - $missing = $analyser->analyze(); + $missing = $this->analyser->analyze($app); $this->assertTrue(is_array($missing)); $this->assertEquals($expectedMissing, $missing); @@ -157,8 +154,7 @@ class DependencyAnalyzer extends \PHPUnit_Framework_TestCase { $app['dependencies']['os'] = $oss; } - $analyser = new \OC\App\DependencyAnalyzer($app, $this->platformMock, $this->l10nMock); - $missing = $analyser->analyze(); + $missing = $this->analyser->analyze($app); $this->assertTrue(is_array($missing)); $this->assertEquals($expectedMissing, $missing); @@ -177,8 +173,7 @@ class DependencyAnalyzer extends \PHPUnit_Framework_TestCase { $app['dependencies']['owncloud'] = $oc; } - $analyser = new \OC\App\DependencyAnalyzer($app, $this->platformMock, $this->l10nMock); - $missing = $analyser->analyze(); + $missing = $this->analyser->analyze($app); $this->assertTrue(is_array($missing)); $this->assertEquals($expectedMissing, $missing); -- cgit v1.2.3