diff options
author | Matthieu Napoli <matthieu@mnapoli.fr> | 2015-04-14 05:13:39 +0300 |
---|---|---|
committer | Matthieu Napoli <matthieu@mnapoli.fr> | 2015-04-14 05:13:39 +0300 |
commit | 290978d6c147a0da344c439ca02742f23e7c4d2d (patch) | |
tree | 30d986088f1075ee08948b100334cf50b2138301 /plugins/Diagnostics | |
parent | 409d6924e2777d90b196e39df8926f70959ee8d6 (diff) |
Improved test
Diffstat (limited to 'plugins/Diagnostics')
-rw-r--r-- | plugins/Diagnostics/Test/Mock/DiagnosticWithSuccess.php | 22 | ||||
-rw-r--r-- | plugins/Diagnostics/Test/Unit/DiagnosticServiceTest.php | 6 |
2 files changed, 27 insertions, 1 deletions
diff --git a/plugins/Diagnostics/Test/Mock/DiagnosticWithSuccess.php b/plugins/Diagnostics/Test/Mock/DiagnosticWithSuccess.php new file mode 100644 index 0000000000..ad01d95710 --- /dev/null +++ b/plugins/Diagnostics/Test/Mock/DiagnosticWithSuccess.php @@ -0,0 +1,22 @@ +<?php +/** + * Piwik - free/libre analytics platform + * + * @link http://piwik.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + */ + +namespace Piwik\Plugins\Diagnostics\Test\Mock; + +use Piwik\Plugins\Diagnostics\Diagnostic\Diagnostic; +use Piwik\Plugins\Diagnostics\Diagnostic\DiagnosticResult; + +class DiagnosticWithSuccess implements Diagnostic +{ + public function execute() + { + return array( + DiagnosticResult::singleResult('Success', DiagnosticResult::STATUS_OK, 'Comment'), + ); + } +} diff --git a/plugins/Diagnostics/Test/Unit/DiagnosticServiceTest.php b/plugins/Diagnostics/Test/Unit/DiagnosticServiceTest.php index c4375dd648..88163fcf7a 100644 --- a/plugins/Diagnostics/Test/Unit/DiagnosticServiceTest.php +++ b/plugins/Diagnostics/Test/Unit/DiagnosticServiceTest.php @@ -11,6 +11,7 @@ namespace Piwik\Plugins\Diagnostics\Test\Unit; use Piwik\Plugins\Diagnostics\Diagnostic\DiagnosticResult; use Piwik\Plugins\Diagnostics\DiagnosticService; use Piwik\Plugins\Diagnostics\Test\Mock\DiagnosticWithError; +use Piwik\Plugins\Diagnostics\Test\Mock\DiagnosticWithSuccess; use Piwik\Plugins\Diagnostics\Test\Mock\DiagnosticWithWarning; class DiagnosticServiceTest extends \PHPUnit_Framework_TestCase @@ -22,6 +23,7 @@ class DiagnosticServiceTest extends \PHPUnit_Framework_TestCase ); $optionalDiagnostics = array( new DiagnosticWithWarning(), + new DiagnosticWithSuccess(), ); $service = new DiagnosticService($mandatoryDiagnostics, $optionalDiagnostics); @@ -30,10 +32,12 @@ class DiagnosticServiceTest extends \PHPUnit_Framework_TestCase $results = $report->getAllResults(); - $this->assertCount(2, $results); + $this->assertCount(3, $results); $this->assertEquals('Error', $results[0]->getLabel()); $this->assertEquals(DiagnosticResult::STATUS_ERROR, $results[0]->getStatus()); $this->assertEquals('Warning', $results[1]->getLabel()); $this->assertEquals(DiagnosticResult::STATUS_WARNING, $results[1]->getStatus()); + $this->assertEquals('Success', $results[2]->getLabel()); + $this->assertEquals(DiagnosticResult::STATUS_OK, $results[2]->getStatus()); } } |