Issue #2298667 by Mile23, neclimdul: Fixed Code review for report generation.

8.0.x
Alex Pott 2014-07-16 12:43:37 +01:00
parent 675f72fa6d
commit 045d3ed92f
9 changed files with 29 additions and 33 deletions

View File

@ -82,13 +82,6 @@ class BlockTest extends MigrateSqlSourceTestCase {
parent::setUp(); parent::setUp();
} }
/**
* {@inheritdoc}
*/
public function testRetrieval() {
// FakeSelect does not support multiple source identifiers, can not test.
}
} }
namespace Drupal\migrate_drupal\Tests\source\d6; namespace Drupal\migrate_drupal\Tests\source\d6;

View File

@ -94,13 +94,6 @@ class FieldInstanceTest extends MigrateSqlSourceTestCase {
parent::setUp(); parent::setUp();
} }
/**
* {@inheritdoc}
*/
public function testRetrieval() {
// FakeSelect does not support multiple source identifiers, can not test.
}
} }
namespace Drupal\migrate_drupal\Tests\source\d6; namespace Drupal\migrate_drupal\Tests\source\d6;

View File

@ -329,7 +329,8 @@ class NodeRevisionTest extends MigrateSqlSourceTestCase {
* {@inheritdoc} * {@inheritdoc}
*/ */
public function testRetrieval() { public function testRetrieval() {
// FakeSelect does not support multiple source identifiers, can not test. // @todo: Fix this as per https://www.drupal.org/node/2299795
$this->markTestIncomplete('FakeSelect does not support multiple source identifiers, can not test.');
} }
} }

View File

@ -13,7 +13,7 @@ use Drupal\Component\Utility\String;
use Drupal\Tests\UnitTestCase; use Drupal\Tests\UnitTestCase;
/** /**
* @coversDefaultClass \Drupal\Component\Utility\Url * @coversDefaultClass \Drupal\Component\Utility\UrlHelper
* @group Utility * @group Utility
*/ */
class UrlHelperTest extends UnitTestCase { class UrlHelperTest extends UnitTestCase {

View File

@ -264,7 +264,8 @@ class ContentEntityBaseUnitTest extends UnitTestCase {
// This method is internal, so check for errors on calling it only. // This method is internal, so check for errors on calling it only.
$storage = $this->getMock('\Drupal\Core\Entity\EntityStorageInterface'); $storage = $this->getMock('\Drupal\Core\Entity\EntityStorageInterface');
$record = new \stdClass(); $record = new \stdClass();
$this->entity->preSaveRevision($storage, $record); // Our mocked entity->preSaveRevision() returns NULL, so assert that.
$this->assertNull($this->entity->preSaveRevision($storage, $record));
} }
/** /**
@ -352,7 +353,8 @@ class ContentEntityBaseUnitTest extends UnitTestCase {
public function testSetContext() { public function testSetContext() {
$name = $this->randomName(); $name = $this->randomName();
$parent = $this->getMock('\Drupal\Core\TypedData\TypedDataInterface'); $parent = $this->getMock('\Drupal\Core\TypedData\TypedDataInterface');
$this->entity->setContext($name, $parent); // Our mocked entity->setContext() returns NULL, so assert that.
$this->assertNull($this->entity->setContext($name, $parent));
} }
/** /**

View File

@ -60,7 +60,6 @@ class EntityResolverManagerTest extends UnitTestCase {
* {@inheritdoc} * {@inheritdoc}
* *
* @covers ::__construct() * @covers ::__construct()
* @covers ::setContainer()
*/ */
protected function setUp() { protected function setUp() {
$this->entityManager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface'); $this->entityManager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface');

View File

@ -530,7 +530,8 @@ class EntityUnitTest extends UnitTestCase {
public function testPreSave() { public function testPreSave() {
// This method is internal, so check for errors on calling it only. // This method is internal, so check for errors on calling it only.
$storage = $this->getMock('\Drupal\Core\Entity\EntityStorageInterface'); $storage = $this->getMock('\Drupal\Core\Entity\EntityStorageInterface');
$this->entity->preSave($storage); // Our mocked entity->preSave() returns NULL, so assert that.
$this->assertNull($this->entity->preSave($storage));
} }
/** /**
@ -566,7 +567,8 @@ class EntityUnitTest extends UnitTestCase {
// This method is internal, so check for errors on calling it only. // This method is internal, so check for errors on calling it only.
$storage = $this->getMock('\Drupal\Core\Entity\EntityStorageInterface'); $storage = $this->getMock('\Drupal\Core\Entity\EntityStorageInterface');
$values = array(); $values = array();
$this->entity->preCreate($storage, $values); // Our mocked entity->preCreate() returns NULL, so assert that.
$this->assertNull($this->entity->preCreate($storage, $values));
} }
/** /**
@ -575,7 +577,8 @@ class EntityUnitTest extends UnitTestCase {
public function testPostCreate() { public function testPostCreate() {
// This method is internal, so check for errors on calling it only. // This method is internal, so check for errors on calling it only.
$storage = $this->getMock('\Drupal\Core\Entity\EntityStorageInterface'); $storage = $this->getMock('\Drupal\Core\Entity\EntityStorageInterface');
$this->entity->postCreate($storage); // Our mocked entity->postCreate() returns NULL, so assert that.
$this->assertNull($this->entity->postCreate($storage));
} }
/** /**
@ -584,7 +587,8 @@ class EntityUnitTest extends UnitTestCase {
public function testPreDelete() { public function testPreDelete() {
// This method is internal, so check for errors on calling it only. // This method is internal, so check for errors on calling it only.
$storage = $this->getMock('\Drupal\Core\Entity\EntityStorageInterface'); $storage = $this->getMock('\Drupal\Core\Entity\EntityStorageInterface');
$this->entity->preDelete($storage, array($this->entity)); // Our mocked entity->preDelete() returns NULL, so assert that.
$this->assertNull($this->entity->preDelete($storage, array($this->entity)));
} }
/** /**
@ -617,7 +621,8 @@ class EntityUnitTest extends UnitTestCase {
// This method is internal, so check for errors on calling it only. // This method is internal, so check for errors on calling it only.
$storage = $this->getMock('\Drupal\Core\Entity\EntityStorageInterface'); $storage = $this->getMock('\Drupal\Core\Entity\EntityStorageInterface');
$entities = array($this->entity); $entities = array($this->entity);
$this->entity->postLoad($storage, $entities); // Our mocked entity->postLoad() returns NULL, so assert that.
$this->assertNull($this->entity->postLoad($storage, $entities));
} }
/** /**

View File

@ -91,9 +91,9 @@ class AccessSubscriberTest extends UnitTestCase {
} }
/** /**
* Tests access denied throws a Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException exception. * Tests access denied throws an exception.
* *
* @expectedException Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException * @expectedException \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException
*/ */
public function testAccessSubscriberThrowsAccessDeniedException() { public function testAccessSubscriberThrowsAccessDeniedException() {
@ -132,25 +132,27 @@ class AccessSubscriberTest extends UnitTestCase {
} }
/** /**
* Tests that if access is granted, AccessSubscriber will not throw a Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException exception. * Tests that if access is granted, AccessSubscriber will not throw an exception.
*/ */
public function testAccessSubscriberDoesNotAlterRequestIfAccessManagerGrantsAccess() { public function testAccessSubscriberDoesNotAlterRequestIfAccessManagerGrantsAccess() {
$this->parameterBag->expects($this->any()) $this->parameterBag->expects($this->once())
->method('has') ->method('has')
->with(RouteObjectInterface::ROUTE_OBJECT) ->with(RouteObjectInterface::ROUTE_OBJECT)
->will($this->returnValue(TRUE)); ->will($this->returnValue(TRUE));
$this->parameterBag->expects($this->any()) $this->parameterBag->expects($this->once())
->method('get') ->method('get')
->with(RouteObjectInterface::ROUTE_OBJECT) ->with(RouteObjectInterface::ROUTE_OBJECT)
->will($this->returnValue($this->route)); ->will($this->returnValue($this->route));
$this->accessManager->expects($this->any()) $this->accessManager->expects($this->once())
->method('check') ->method('check')
->with($this->anything()) ->with($this->equalTo($this->route))
->will($this->returnValue(TRUE)); ->will($this->returnValue(TRUE));
$subscriber = new AccessSubscriber($this->accessManager, $this->currentUser); $subscriber = new AccessSubscriber($this->accessManager, $this->currentUser);
// We're testing that no exception is thrown in this case. There is no
// return.
$subscriber->onKernelRequestAccessCheck($this->event); $subscriber->onKernelRequestAccessCheck($this->event);
} }

View File

@ -42,7 +42,8 @@ class ModuleRouteSubscriberTest extends UnitTestCase {
/** /**
* Tests that removeRoute() removes routes when the module is not enabled. * Tests that removeRoute() removes routes when the module is not enabled.
* *
* @dataProvider testRemoveRouteProvider * @dataProvider providerTestRemoveRoute
* @covers ::onAlterRoutes
* *
* @param string $route_name * @param string $route_name
* The machine name for the route. * The machine name for the route.
@ -71,7 +72,7 @@ class ModuleRouteSubscriberTest extends UnitTestCase {
/** /**
* Data provider for testRemoveRoute(). * Data provider for testRemoveRoute().
*/ */
public function testRemoveRouteProvider() { public function providerTestRemoveRoute() {
return array( return array(
array('enabled', array('_module_dependencies' => 'enabled'), FALSE), array('enabled', array('_module_dependencies' => 'enabled'), FALSE),
array('disabled', array('_module_dependencies' => 'disabled'), TRUE), array('disabled', array('_module_dependencies' => 'disabled'), TRUE),