summaryrefslogtreecommitdiffstats
path: root/tests/src/Unit/Plugin
diff options
context:
space:
mode:
authorJoris Vercammen2015-11-04 14:36:06 (GMT)
committerJoris Vercammen2015-11-04 14:36:06 (GMT)
commite94e71efd732937629c26b7315234ca5f539f67b (patch)
tree652fa0973e96bdc9822de81ffa81db5bbd31d256 /tests/src/Unit/Plugin
parentefe3f545c2c74314dfbb9c0770606e9a866e3ed0 (diff)
Cleanup unit tests documentation
Diffstat (limited to 'tests/src/Unit/Plugin')
-rw-r--r--tests/src/Unit/Plugin/processor/ActiveWidgetOrderProcessorTest.php14
-rw-r--r--tests/src/Unit/Plugin/processor/CountWidgetOrderProcessorTest.php3
-rw-r--r--tests/src/Unit/Plugin/processor/DisplayValueWidgetOrderProcessorTest.php11
-rw-r--r--tests/src/Unit/Plugin/processor/HideNonNarrowingResultProcessorTest.php5
-rw-r--r--tests/src/Unit/Plugin/processor/MinimumCountProcessorTest.php5
-rw-r--r--tests/src/Unit/Plugin/processor/RawValueWidgetOrderProcessorTest.php7
6 files changed, 21 insertions, 24 deletions
diff --git a/tests/src/Unit/Plugin/processor/ActiveWidgetOrderProcessorTest.php b/tests/src/Unit/Plugin/processor/ActiveWidgetOrderProcessorTest.php
index f0f2f23..ba3a785 100644
--- a/tests/src/Unit/Plugin/processor/ActiveWidgetOrderProcessorTest.php
+++ b/tests/src/Unit/Plugin/processor/ActiveWidgetOrderProcessorTest.php
@@ -8,7 +8,6 @@
namespace Drupal\Tests\facetapi\Unit\Plugin\Processor;
use Drupal\facetapi\Plugin\facetapi\processor\ActiveWidgetOrderProcessor;
-use Drupal\facetapi\Processor\WidgetOrderProcessorInterface;
use Drupal\facetapi\Result\Result;
use Drupal\Tests\UnitTestCase;
@@ -20,7 +19,7 @@ class ActiveWidgetOrderProcessorTest extends UnitTestCase {
/**
* The processor to be tested.
*
- * @var WidgetOrderProcessorInterface
+ * @var \Drupal\facetapi\processor\WidgetOrderProcessorInterface
*/
protected $processor;
@@ -37,7 +36,8 @@ class ActiveWidgetOrderProcessorTest extends UnitTestCase {
protected function setUp() {
parent::setUp();
- $this->original_results = [
+ /** @var \Drupal\facetapi\Result\Result[] $original_results */
+ $original_results = [
new Result('Boxer', 'Boxer', 10),
new Result('Old Major', 'Old Major', 3),
new Result('Minimus', 'Minimus', 60),
@@ -45,9 +45,11 @@ class ActiveWidgetOrderProcessorTest extends UnitTestCase {
new Result('Clover', 'Clover', 50),
];
- $this->original_results[1]->setActiveState(true);
- $this->original_results[2]->setActiveState(true);
- $this->original_results[3]->setActiveState(true);
+ $original_results[1]->setActiveState(true);
+ $original_results[2]->setActiveState(true);
+ $original_results[3]->setActiveState(true);
+
+ $this->original_results = $original_results;
$this->processor = new ActiveWidgetOrderProcessor([], 'active_widget_order', []);
}
diff --git a/tests/src/Unit/Plugin/processor/CountWidgetOrderProcessorTest.php b/tests/src/Unit/Plugin/processor/CountWidgetOrderProcessorTest.php
index 0586ec8..a05d8bf 100644
--- a/tests/src/Unit/Plugin/processor/CountWidgetOrderProcessorTest.php
+++ b/tests/src/Unit/Plugin/processor/CountWidgetOrderProcessorTest.php
@@ -8,7 +8,6 @@
namespace Drupal\Tests\facetapi\Unit\Plugin\Processor;
use Drupal\facetapi\Plugin\facetapi\processor\CountWidgetOrderProcessor;
-use Drupal\facetapi\Processor\WidgetOrderProcessorInterface;
use Drupal\facetapi\Result\Result;
use Drupal\Tests\UnitTestCase;
@@ -20,7 +19,7 @@ class CountWidgetOrderProcessorTest extends UnitTestCase {
/**
* The processor to be tested.
*
- * @var WidgetOrderProcessorInterface
+ * @var \Drupal\facetapi\processor\WidgetOrderProcessorInterface
*/
protected $processor;
diff --git a/tests/src/Unit/Plugin/processor/DisplayValueWidgetOrderProcessorTest.php b/tests/src/Unit/Plugin/processor/DisplayValueWidgetOrderProcessorTest.php
index 3794284..f55e1ac 100644
--- a/tests/src/Unit/Plugin/processor/DisplayValueWidgetOrderProcessorTest.php
+++ b/tests/src/Unit/Plugin/processor/DisplayValueWidgetOrderProcessorTest.php
@@ -8,7 +8,6 @@
namespace Drupal\Tests\facetapi\Unit\Plugin\Processor;
use Drupal\facetapi\Plugin\facetapi\processor\DisplayValueWidgetOrderProcessor;
-use Drupal\facetapi\Processor\WidgetOrderProcessorInterface;
use Drupal\facetapi\Result\Result;
use Drupal\Tests\UnitTestCase;
@@ -20,7 +19,7 @@ class DisplayValueWidgetOrderProcessorTest extends UnitTestCase {
/**
* The processor to be tested.
*
- * @var WidgetOrderProcessorInterface
+ * @var \Drupal\facetapi\processor\WidgetOrderProcessorInterface
*/
protected $processor;
@@ -55,7 +54,7 @@ class DisplayValueWidgetOrderProcessorTest extends UnitTestCase {
*/
public function testAscending() {
$sorted_results = $this->processor->sortResults($this->original_results, 'ASC');
- $expected_values = array('2', '1977', 'FALSE', 'Hubbard', 'thetans', 'Tom', 'xenu');
+ $expected_values = ['2', '1977', 'FALSE', 'Hubbard', 'thetans', 'Tom', 'xenu'];
foreach ($expected_values as $index => $value) {
$this->assertEquals($value, $sorted_results[$index]->getDisplayValue());
}
@@ -66,12 +65,15 @@ class DisplayValueWidgetOrderProcessorTest extends UnitTestCase {
*/
public function testDescending() {
$sorted_results = $this->processor->sortResults($this->original_results, 'DESC');
- $expected_values = array_reverse(array('2', '1977', 'FALSE', 'Hubbard', 'thetans', 'Tom', 'xenu'));
+ $expected_values = array_reverse(['2', '1977', 'FALSE', 'Hubbard', 'thetans', 'Tom', 'xenu']);
foreach ($expected_values as $index => $value) {
$this->assertEquals($value, $sorted_results[$index]->getDisplayValue());
}
}
+ /**
+ * Test that sorting uses the display value.
+ */
public function testUseActualDisplayValue() {
$original = [
new Result('bb_test', 'Test AA', 10),
@@ -82,7 +84,6 @@ class DisplayValueWidgetOrderProcessorTest extends UnitTestCase {
$this->assertEquals('Test BB', $sorted_results[0]->getDisplayValue());
$this->assertEquals('Test AA', $sorted_results[1]->getDisplayValue());
-
}
}
diff --git a/tests/src/Unit/Plugin/processor/HideNonNarrowingResultProcessorTest.php b/tests/src/Unit/Plugin/processor/HideNonNarrowingResultProcessorTest.php
index 1303518..70e7f37 100644
--- a/tests/src/Unit/Plugin/processor/HideNonNarrowingResultProcessorTest.php
+++ b/tests/src/Unit/Plugin/processor/HideNonNarrowingResultProcessorTest.php
@@ -9,7 +9,6 @@ namespace Drupal\Tests\facetapi\Unit\Plugin\Processor;
use Drupal\facetapi\Entity\Facet;
use Drupal\facetapi\Plugin\facetapi\processor\HideNonNarrowingResultProcessor;
-use Drupal\facetapi\Processor\WidgetOrderProcessorInterface;
use Drupal\facetapi\Result\Result;
use Drupal\Tests\UnitTestCase;
@@ -21,7 +20,7 @@ class HideNonNarrowingResultProcessorTest extends UnitTestCase {
/**
* The processor to be tested.
*
- * @var WidgetOrderProcessorInterface
+ * @var \Drupal\facetapi\processor\WidgetOrderProcessorInterface
*/
protected $processor;
@@ -83,7 +82,7 @@ class HideNonNarrowingResultProcessorTest extends UnitTestCase {
$this->assertCount(2, $filtered_results);
- // Llama is shown because it does filtering.
+ // Llama is shown because it narrows results.
$this->assertEquals(10, $filtered_results[0]->getCount());
$this->assertEquals('llama', $filtered_results[0]->getDisplayValue());
diff --git a/tests/src/Unit/Plugin/processor/MinimumCountProcessorTest.php b/tests/src/Unit/Plugin/processor/MinimumCountProcessorTest.php
index 5e87bc8..8767fc4 100644
--- a/tests/src/Unit/Plugin/processor/MinimumCountProcessorTest.php
+++ b/tests/src/Unit/Plugin/processor/MinimumCountProcessorTest.php
@@ -9,7 +9,6 @@ namespace Drupal\Tests\facetapi\Unit\Plugin\Processor;
use Drupal\facetapi\Entity\Facet;
use Drupal\facetapi\Plugin\facetapi\processor\MinimumCountProcessor;
-use Drupal\facetapi\Processor\BuildProcessorInterface;
use Drupal\facetapi\Result\Result;
use Drupal\Tests\UnitTestCase;
@@ -21,7 +20,7 @@ class MinimumCountProcessorTest extends UnitTestCase {
/**
* The processor to be tested.
*
- * @var BuildProcessorInterface
+ * @var \Drupal\facetapi\processor\BuildProcessorInterface
*/
protected $processor;
@@ -64,9 +63,7 @@ class MinimumCountProcessorTest extends UnitTestCase {
$this->assertCount(2, $sorted_results);
- $this->assertEquals(10, $sorted_results[0]->getCount());
$this->assertEquals('llama', $sorted_results[0]->getDisplayValue());
- $this->assertEquals(15, $sorted_results[2]->getCount());
$this->assertEquals('duck', $sorted_results[2]->getDisplayValue());
}
diff --git a/tests/src/Unit/Plugin/processor/RawValueWidgetOrderProcessorTest.php b/tests/src/Unit/Plugin/processor/RawValueWidgetOrderProcessorTest.php
index 7b8f12e..00d738c 100644
--- a/tests/src/Unit/Plugin/processor/RawValueWidgetOrderProcessorTest.php
+++ b/tests/src/Unit/Plugin/processor/RawValueWidgetOrderProcessorTest.php
@@ -8,7 +8,6 @@
namespace Drupal\Tests\facetapi\Unit\Plugin\Processor;
use Drupal\facetapi\Plugin\facetapi\processor\RawValueWidgetOrderProcessor;
-use Drupal\facetapi\Processor\WidgetOrderProcessorInterface;
use Drupal\facetapi\Result\Result;
use Drupal\Tests\UnitTestCase;
@@ -20,7 +19,7 @@ class RawValueWidgetOrderProcessorTest extends UnitTestCase {
/**
* The processor to be tested.
*
- * @var WidgetOrderProcessorInterface
+ * @var \Drupal\facetapi\processor\WidgetOrderProcessorInterface
*/
protected $processor;
@@ -55,7 +54,7 @@ class RawValueWidgetOrderProcessorTest extends UnitTestCase {
*/
public function testAscending() {
$sorted_results = $this->processor->sortResults($this->original_results, 'ASC');
- $expected_values = array('Tom', 'xenu', 'thetans', 'Hubbard', 'FALSE', '2', '1977');
+ $expected_values = ['Tom', 'xenu', 'thetans', 'Hubbard', 'FALSE', '2', '1977'];
foreach ($expected_values as $index => $value) {
$this->assertEquals($value, $sorted_results[$index]->getDisplayValue());
}
@@ -66,7 +65,7 @@ class RawValueWidgetOrderProcessorTest extends UnitTestCase {
*/
public function testDescending() {
$sorted_results = $this->processor->sortResults($this->original_results, 'DESC');
- $expected_values = array_reverse(array('Tom', 'xenu', 'thetans', 'Hubbard', 'FALSE', '2', '1977'));
+ $expected_values = array_reverse(['Tom', 'xenu', 'thetans', 'Hubbard', 'FALSE', '2', '1977']);
foreach ($expected_values as $index => $value) {
$this->assertEquals($value, $sorted_results[$index]->getDisplayValue());
}