| 1 | <?php |
||
| 14 | class RepositoryTest extends WebTestCase |
||
| 15 | { |
||
| 16 | /** @var MockRepository Mock of an abstract Repository class. */ |
||
| 17 | private $stub; |
||
| 18 | |||
| 19 | protected function setUp() |
||
| 20 | { |
||
| 21 | $this->stub = $this->getMockForAbstractClass('Xtools\Repository'); |
||
| 22 | } |
||
| 23 | |||
| 24 | /** |
||
| 25 | * Test that the table-name transformations are correct. |
||
| 26 | */ |
||
| 27 | public function testGetTableName() |
||
| 28 | { |
||
| 29 | $client = static::createClient(); |
||
| 30 | $this->container = $client->getContainer(); |
||
| 31 | |||
| 32 | $this->stub->setContainer($this->container); |
||
| 33 | |||
| 34 | if ($this->container->getParameter('app.is_labs')) { |
||
| 35 | // When using Labs. |
||
| 36 | $this->assertEquals('`testwiki_p`.`page`', $this->stub->getTableName('testwiki', 'page')); |
||
| 37 | $this->assertEquals('`testwiki_p`.`logging_userindex`', $this->stub->getTableName('testwiki', 'logging')); |
||
| 38 | } else { |
||
| 39 | // When using wiki databases directly. |
||
| 40 | $this->assertEquals('`testwiki`.`page`', $this->stub->getTableName('testwiki', 'page')); |
||
| 41 | $this->assertEquals('`testwiki`.`logging`', $this->stub->getTableName('testwiki', 'logging')); |
||
| 42 | } |
||
| 43 | } |
||
| 44 | } |
||
| 45 |