diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateBookTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateBookTest.php index e9a9bfb..d98fb5e 100644 --- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateBookTest.php +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateBookTest.php @@ -38,6 +38,7 @@ protected function setUp() { $entity = entity_create('node', array( 'type' => 'story', 'nid' => $i, + 'status' => TRUE, )); $entity->enforceIsNew(); $entity->save(); diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateTaxonomyTermTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateTaxonomyTermTest.php index 6f963ae..3b508f3 100644 --- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateTaxonomyTermTest.php +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateTaxonomyTermTest.php @@ -61,11 +61,13 @@ public function testTaxonomyTerms() { 'source_vid' => 1, 'vid' => 'vocabulary_1_i_0_', 'weight' => 0, + 'parent' => array(0), ), '2' => array( 'source_vid' => 2, 'vid' => 'vocabulary_2_i_1_', 'weight' => 3, + 'parent' => array(0), ), '3' => array( 'source_vid' => 2, @@ -77,6 +79,7 @@ public function testTaxonomyTerms() { 'source_vid' => 3, 'vid' => 'vocabulary_3_i_2_', 'weight' => 6, + 'parent' => array(0), ), '5' => array( 'source_vid' => 3, @@ -99,8 +102,8 @@ public function testTaxonomyTerms() { $this->assertIdentical($term->description->value, "description of term {$tid} of vocabulary {$values['source_vid']}"); $this->assertEqual($term->vid->value, $values['vid']); $this->assertEqual($term->weight->value, $values['weight']); - if (empty($values['parent'])) { - $this->assertNull($term->parent->value); + if ($values['parent'] === array(0)) { + $this->assertEqual($term->parent->value, 0); } else { $parents = array(); diff --git a/core/modules/simpletest/lib/Drupal/simpletest/Tests/DrupalUnitTestBaseTest.php b/core/modules/simpletest/lib/Drupal/simpletest/Tests/DrupalUnitTestBaseTest.php index 6b76615..5c9b464 100644 --- a/core/modules/simpletest/lib/Drupal/simpletest/Tests/DrupalUnitTestBaseTest.php +++ b/core/modules/simpletest/lib/Drupal/simpletest/Tests/DrupalUnitTestBaseTest.php @@ -19,7 +19,7 @@ class DrupalUnitTestBaseTest extends DrupalUnitTestBase { * * @var array */ - public static $modules = array('entity', 'entity_test', 'field', 'database_test'); + public static $modules = array('entity', 'entity_test', 'field'); public static function getInfo() { return array( @@ -125,20 +125,9 @@ function testEnableModulesInstallContainer() { * Tests expected behavior of installSchema(). */ function testInstallSchema() { + // Verify that a table from a unknown module cannot be installed. $module = 'database_test'; $table = 'test'; - // Verify that we can install a table from the module schema. - $this->installSchema($module, $table); - $this->assertTrue(db_table_exists($table), "'$table' database table found."); - - // Verify that the schema is known to Schema API. - $schema = drupal_get_schema(); - $this->assertTrue($schema[$table], "'$table' table found in schema."); - $schema = drupal_get_schema($table); - $this->assertTrue($schema, "'$table' table schema found."); - - // Verify that a unknown table from an enabled module throws an error. - $table = 'unknown_entity_test_table'; try { $this->installSchema($module, $table); $this->fail('Exception for non-retrievable schema found.'); @@ -150,9 +139,19 @@ function testInstallSchema() { $schema = drupal_get_schema($table); $this->assertFalse($schema, "'$table' table schema not found."); - // Verify that a table from a unknown module cannot be installed. - $module = 'database_test'; - $table = 'test'; + // Verify that the same table can be installed after enabling the module. + $this->enableModules(array($module)); + $this->installSchema($module, $table); + $this->assertTrue(db_table_exists($table), "'$table' database table found."); + + // Verify that the schema is known to Schema API. + $schema = drupal_get_schema(); + $this->assertTrue($schema[$table], "'$table' table found in schema."); + $schema = drupal_get_schema($table); + $this->assertTrue($schema, "'$table' table schema found."); + + // Verify that a unknown table from an enabled module throws an error. + $table = 'unknown_entity_test_table'; try { $this->installSchema($module, $table); $this->fail('Exception for non-retrievable schema found.'); @@ -163,13 +162,6 @@ function testInstallSchema() { $this->assertFalse(db_table_exists($table), "'$table' database table not found."); $schema = drupal_get_schema($table); $this->assertFalse($schema, "'$table' table schema not found."); - - // Verify that the same table can be installed after enabling the module. - $this->enableModules(array($module)); - $this->installSchema($module, $table); - $this->assertTrue(db_table_exists($table), "'$table' database table found."); - $schema = drupal_get_schema($table); - $this->assertTrue($schema, "'$table' table schema found."); } /** diff --git a/core/tests/Drupal/Tests/Core/Entity/ContentEntityDatabaseStorageTest.php b/core/tests/Drupal/Tests/Core/Entity/ContentEntityDatabaseStorageTest.php index 87ed844..66fe5b5 100644 --- a/core/tests/Drupal/Tests/Core/Entity/ContentEntityDatabaseStorageTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/ContentEntityDatabaseStorageTest.php @@ -120,9 +120,15 @@ public function testCreate() { $module_handler = $this->getMock('Drupal\Core\Extension\ModuleHandlerInterface'); $entity_manager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface'); // @todo Add field definitions to test default values of fields. - $entity_manager->expects($this->atLeastOnce()) + $definitions = array(); + $entity_manager->expects($this->once()) + ->method('getFieldStorageDefinitions') + ->will($this->returnValue($definitions)); + // ContentEntityStorageBase iterates over the entity which calls this method + // internally in ContentEntityBase::getProperties(). + $entity_manager->expects($this->once()) ->method('getFieldDefinitions') - ->will($this->returnValue(array())); + ->will($this->returnValue($definitions)); $container = new ContainerBuilder(); $container->set('language_manager', $language_manager); @@ -130,7 +136,10 @@ public function testCreate() { $container->set('module_handler', $module_handler); \Drupal::setContainer($container); - $entity = $this->getMockForAbstractClass('Drupal\Core\Entity\ContentEntityBase', array(), '', FALSE, TRUE, TRUE, array('id')); + $entity = $this->getMockBuilder('Drupal\Core\Entity\ContentEntityBase') + ->disableOriginalConstructor() + ->setMethods(array('id')) + ->getMockForAbstractClass(); $entity_type = $this->getMock('Drupal\Core\Entity\EntityTypeInterface'); $entity_type->expects($this->atLeastOnce()) ->method('id') @@ -154,7 +163,7 @@ public function testCreate() { $connection = $this->getMockBuilder('Drupal\Core\Database\Connection') ->disableOriginalConstructor() ->getMock(); - $field_info = $this->getMockBuilder('\Drupal\field\FieldInfo') + $field_info = $this->getMockBuilder('Drupal\field\FieldInfo') ->disableOriginalConstructor() ->getMock(); $entity_storage = new ContentEntityDatabaseStorage($entity_type, $connection, $entity_manager, $field_info);