diff --git a/tests/src/Unit/Component/CsvParserTest.php b/tests/src/Unit/Component/CsvParserTest.php index a91ac03..72226ac 100644 --- a/tests/src/Unit/Component/CsvParserTest.php +++ b/tests/src/Unit/Component/CsvParserTest.php @@ -6,12 +6,14 @@ use Drupal\feeds\Component\CsvParser; use Drupal\Tests\feeds\Unit\FeedsUnitTestCase; /** - * @group feeds * @coversDefaultClass \Drupal\feeds\Component\CsvParser + * @group feeds */ class CsvParserTest extends FeedsUnitTestCase { /** + * Tests parsing a CSV source with several line endings. + * * @dataProvider provider */ public function testAlternateLineEnding(array $expected, $ending) { @@ -97,6 +99,8 @@ class CsvParserTest extends FeedsUnitTestCase { } /** + * Tries to create a CsvParser instance with an invalid file path. + * * @expectedException \InvalidArgumentException */ public function testInvalidFilePath() { @@ -104,6 +108,8 @@ class CsvParserTest extends FeedsUnitTestCase { } /** + * Creates a new CsvParser instance with an invalid CSV source. + * * @expectedException \InvalidArgumentException */ public function testInvalidResourcePath() { @@ -111,6 +117,8 @@ class CsvParserTest extends FeedsUnitTestCase { } /** + * Basic test for parsing CSV. + * * @dataProvider csvFileProvider */ public function testCsvParsing($file, $expected) { diff --git a/tests/src/Unit/Component/HttpHelpersTest.php b/tests/src/Unit/Component/HttpHelpersTest.php index 50f6ad1..d36daf5 100644 --- a/tests/src/Unit/Component/HttpHelpersTest.php +++ b/tests/src/Unit/Component/HttpHelpersTest.php @@ -12,6 +12,8 @@ use Drupal\Tests\UnitTestCase; class HttpHelpersTest extends UnitTestCase { /** + * Tests finding relation links in several headers. + * * @dataProvider httpResponses */ public function testFindLinkHeader($headers, $rel, $expected) { diff --git a/tests/src/Unit/Controller/SubscriptionControllerTest.php b/tests/src/Unit/Controller/SubscriptionControllerTest.php index dbe7798..0615dd8 100644 --- a/tests/src/Unit/Controller/SubscriptionControllerTest.php +++ b/tests/src/Unit/Controller/SubscriptionControllerTest.php @@ -43,6 +43,8 @@ class SubscriptionControllerTest extends UnitTestCase { protected $request; /** + * The subscription entity. + * * @var \Drupal\feeds\SubscriptionInterface */ protected $subscription; @@ -195,7 +197,7 @@ class SubscriptionControllerTest extends UnitTestCase { * @covers ::handleUnsubscribe * @expectedException \Symfony\Component\HttpKernel\Exception\NotFoundHttpException */ - public function testSubscriptionMissingKV() { + public function testSubscriptionMissingKv() { $this->request->query->set('hub_mode', 'unsubscribe'); $this->request->query->set('hub_topic', 'http://example.com/topic'); $this->controller->subscribe(1, 'valid_token', $this->request); diff --git a/tests/src/Unit/FeedExpireHandlerTest.php b/tests/src/Unit/FeedExpireHandlerTest.php index 7dbcd46..ee24a77 100644 --- a/tests/src/Unit/FeedExpireHandlerTest.php +++ b/tests/src/Unit/FeedExpireHandlerTest.php @@ -37,9 +37,16 @@ class FeedExpireHandlerTest extends FeedsUnitTestCase { } /** - * @covers ::expire + * @covers ::startBatchExpire */ - public function testExpire() { + public function testBatchExpire() { + $this->markTestIncomplete('The expire functionality is not working yet.'); + } + + /** + * @covers ::expireItem + */ + public function testExpireItem() { $this->markTestIncomplete('The expire functionality is not working yet.'); $this->feed @@ -51,19 +58,27 @@ class FeedExpireHandlerTest extends FeedsUnitTestCase { ->method('clearStates'); $handler = new FeedExpireHandler($this->dispatcher); - $result = $handler->expire($this->feed); + $result = $handler->expireItem($this->feed); $this->assertSame($result, 0.5); - $result = $handler->expire($this->feed); + $result = $handler->expireItem($this->feed); $this->assertSame($result, 1.0); } /** + * @covers ::postExpire + */ + public function testPostExpire() { + $this->markTestIncomplete('The expire functionality is not working yet.'); + } + + /** + * @covers ::expireItem * @expectedException \Exception */ public function testException() { $this->markTestIncomplete('The expire functionality is not working yet.'); - $this->dispatcher->addListener(FeedsEvents::EXPIRE, function($event) { + $this->dispatcher->addListener(FeedsEvents::EXPIRE, function ($event) { throw new \Exception(); }); @@ -72,7 +87,7 @@ class FeedExpireHandlerTest extends FeedsUnitTestCase { ->method('clearStates'); $handler = new FeedExpireHandler($this->dispatcher); - $handler->expire($this->feed); + $handler->expireItem($this->feed); } } diff --git a/tests/src/Unit/Feeds/Fetcher/DirectoryFetcherTest.php b/tests/src/Unit/Feeds/Fetcher/DirectoryFetcherTest.php index f070c28..1a1c5ae 100644 --- a/tests/src/Unit/Feeds/Fetcher/DirectoryFetcherTest.php +++ b/tests/src/Unit/Feeds/Fetcher/DirectoryFetcherTest.php @@ -79,6 +79,8 @@ class DirectoryFetcherTest extends FeedsUnitTestCase { } /** + * Tests fetching from a directory on which we don't have read permissions. + * * @expectedException \RuntimeException */ public function testFetchDir() { @@ -107,6 +109,8 @@ class DirectoryFetcherTest extends FeedsUnitTestCase { } /** + * Tests fetching an empty directory. + * * @expectedException \Drupal\feeds\Exception\EmptyFeedException */ public function testEmptyDirectory() { diff --git a/tests/src/Unit/Feeds/Fetcher/HttpFetcherTest.php b/tests/src/Unit/Feeds/Fetcher/HttpFetcherTest.php index d1b135e..582302f 100644 --- a/tests/src/Unit/Feeds/Fetcher/HttpFetcherTest.php +++ b/tests/src/Unit/Feeds/Fetcher/HttpFetcherTest.php @@ -85,7 +85,7 @@ class HttpFetcherTest extends FeedsUnitTestCase { } /** - * Tests a fetch from which the HTTP source returns that the feed is not modified. + * Tests fetching from a HTTP source that returns a 304 (not modified). * * @expectedException \Drupal\feeds\Exception\EmptyFeedException */ @@ -95,7 +95,7 @@ class HttpFetcherTest extends FeedsUnitTestCase { } /** - * Tests a fetch from which the HTTP source returns that the feed is not found. + * Tests fetching from a HTTP source that returns a 404 (not found). * * @expectedException \RuntimeException */ diff --git a/tests/src/Unit/Feeds/Parser/OpmlParserTest.php b/tests/src/Unit/Feeds/Parser/OpmlParserTest.php index a31ecd2..4b75c21 100644 --- a/tests/src/Unit/Feeds/Parser/OpmlParserTest.php +++ b/tests/src/Unit/Feeds/Parser/OpmlParserTest.php @@ -85,7 +85,7 @@ class OpmlParserTest extends FeedsUnitTestCase { } /** - * @covers ::testGetMappingSources + * @covers ::getMappingSources */ public function testGetMappingSources() { // Not really much to test here. diff --git a/tests/src/Unit/FeedsUnitTestCase.php b/tests/src/Unit/FeedsUnitTestCase.php index c19e270..fdab781 100644 --- a/tests/src/Unit/FeedsUnitTestCase.php +++ b/tests/src/Unit/FeedsUnitTestCase.php @@ -324,7 +324,8 @@ namespace { * */ function _format_date_callback(array $matches = NULL, $new_langcode = NULL) { - // We cache translations to avoid redundant and rather costly calls to t(). + // We cache translations to avoid redundant and rather costly calls to + // t(). static $cache, $langcode; if (!isset($matches)) { @@ -355,6 +356,7 @@ namespace { } } + /** * */