コード例 #1
0
 /**
  * Tests DefaultTableMapping::getColumnNames().
  *
  * @covers ::__construct()
  * @covers ::getColumnNames()
  */
 public function testGetColumnNames()
 {
     $definitions['test'] = $this->setUpDefinition('test', []);
     $table_mapping = new DefaultTableMapping($definitions);
     $expected = [];
     $this->assertSame($expected, $table_mapping->getColumnNames('test'));
     $definitions['test'] = $this->setUpDefinition('test', ['value']);
     $table_mapping = new DefaultTableMapping($definitions);
     $expected = ['value' => 'test'];
     $this->assertSame($expected, $table_mapping->getColumnNames('test'));
     $definitions['test'] = $this->setUpDefinition('test', ['value', 'format']);
     $table_mapping = new DefaultTableMapping($definitions);
     $expected = ['value' => 'test__value', 'format' => 'test__format'];
     $this->assertSame($expected, $table_mapping->getColumnNames('test'));
 }
コード例 #2
0
 /**
  * Tests DefaultTableMapping::getColumnNames().
  *
  * @covers ::__construct
  * @covers ::getColumnNames
  */
 public function testGetColumnNames()
 {
     $definitions['test'] = $this->setUpDefinition('test', []);
     $table_mapping = new DefaultTableMapping($this->entityType, $definitions);
     $expected = [];
     $this->assertSame($expected, $table_mapping->getColumnNames('test'));
     $definitions['test'] = $this->setUpDefinition('test', ['value']);
     $table_mapping = new DefaultTableMapping($this->entityType, $definitions);
     $expected = ['value' => 'test'];
     $this->assertSame($expected, $table_mapping->getColumnNames('test'));
     $definitions['test'] = $this->setUpDefinition('test', ['value', 'format']);
     $table_mapping = new DefaultTableMapping($this->entityType, $definitions);
     $expected = ['value' => 'test__value', 'format' => 'test__format'];
     $this->assertSame($expected, $table_mapping->getColumnNames('test'));
     $definitions['test'] = $this->setUpDefinition('test', ['value']);
     // Set custom storage.
     $definitions['test']->expects($this->any())->method('hasCustomStorage')->wilLReturn(TRUE);
     $table_mapping = new DefaultTableMapping($this->entityType, $definitions);
     // Should return empty for column names.
     $this->assertSame([], $table_mapping->getColumnNames('test'));
 }