Beispiel #1
0
 /**
  * Prepares data for \Resource::getTableName($modelEntity)
  *
  * @param string $expected
  * @param bool $useSuffix does an entity has a suffix
  * @return array $modelEntity
  */
 private function prepareTableName($expected, $useSuffix = true)
 {
     $this->setConnection();
     $modelEntity = ['modelEntity', 'tableSuffix'];
     $mappedName = 'mappedName';
     $this->_resorce->setMappedTableName($modelEntity[0], $mappedName);
     $this->_connection->expects($this->any())->method('getTableName')->with($useSuffix ? $mappedName . '_' . $modelEntity[1] : $mappedName)->will($this->returnValue($expected));
     return $useSuffix ? $modelEntity : $modelEntity[0];
 }
Beispiel #2
0
 /**
  * @param array|string $modelEntity
  * @param string $tableName
  * @param string $mappedName
  * @param string $expected
  *
  * @dataProvider getTableNameMappedDataProvider
  */
 public function testGetTableNameMapped($modelEntity, $tableName, $mappedName, $expected)
 {
     $this->_connectionFactory->expects($this->once())->method('create')->will($this->returnValue($this->connection));
     $this->resource->setMappedTableName($tableName, $mappedName);
     $this->assertSame($expected, $this->resource->getTableName($modelEntity));
 }