Skip to content

Commit

Permalink
updated test skeletons
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Isler committed Dec 1, 2015
1 parent 5bcadb1 commit aafcfe1
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 68 deletions.
6 changes: 3 additions & 3 deletions src/Spiritix/LadaCache/Reflector/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function __construct(EloquentModel $model)
*
* @return string
*/
public function getDatabase()
protected function getDatabase()
{
return $this->model->getConnection()
->getDatabaseName();
Expand All @@ -54,7 +54,7 @@ public function getDatabase()
*
* @return array
*/
public function getTables()
protected function getTables()
{
return [$this->model->getTable()];
}
Expand All @@ -64,7 +64,7 @@ public function getTables()
*
* @return array
*/
public function getRows()
protected function getRows()
{
return [$this->model->getKey()];
}
Expand Down
18 changes: 18 additions & 0 deletions tests/CacheTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,23 @@

class CacheTest extends TestCase
{
public function testHas()
{
//
}

public function testSet()
{
//
}

public function testGet()
{
//
}

public function testInvalidate()
{
//
}
}
5 changes: 4 additions & 1 deletion tests/Console/FlushCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,8 @@

class FlushCommandTest extends TestCase
{

public function testHandle()
{
//
}
}
13 changes: 13 additions & 0 deletions tests/ManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,18 @@

class ManagerTest extends TestCase
{
public function testGetConfig()
{
//
}

public function testResolve()
{
//
}

public function testFlush()
{
//
}
}
5 changes: 4 additions & 1 deletion tests/RedisTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@

class RedisTest extends TestCase
{

public function testCall()
{
//
}
}
54 changes: 2 additions & 52 deletions tests/Reflector/AbstractReflectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,61 +3,11 @@
namespace Spiritix\LadaCache\Tests\Reflector;

use Spiritix\LadaCache\Tests\TestCase;
use Spiritix\LadaCache\Reflector\AbstractReflector;

class AbstractReflectorTest extends TestCase
{
public function testGetTagsWithRows()
public function testGetTags()
{
$stub = $this->getMockForAbstractClass(AbstractReflector::class);

$stub->method('getDatabase')
->willReturn('database');

$stub->method('getTables')
->willReturn(['table1', 'table2']);

$stub->method('getRows')
->willReturn([1, 2, 3]);

$expected = [
'd:databaset:table1',
'd:databaset:table2',
'd:databaset:table1r:1',
'd:databaset:table1r:2',
'd:databaset:table1r:3',
];

$this->assertEquals($expected, $stub->getTags(true));

$expected = [
'd:databaset:table1r:1',
'd:databaset:table1r:2',
'd:databaset:table1r:3',
];

$this->assertEquals($expected, $stub->getTags(false));
}

public function testGetTagsWithoutRows()
{
$stub = $this->getMockForAbstractClass(AbstractReflector::class);

$stub->method('getDatabase')
->willReturn('database');

$stub->method('getTables')
->willReturn(['table1', 'table2']);

$stub->method('getRows')
->willReturn([]);

$expected = [
'd:databaset:table1',
'd:databaset:table2',
];

$this->assertEquals($expected, $stub->getTags(true));
$this->assertEquals($expected, $stub->getTags(false));
//
}
}
10 changes: 0 additions & 10 deletions tests/Reflector/ModelTest.php

This file was deleted.

5 changes: 4 additions & 1 deletion tests/Reflector/QueryBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,8 @@

class QueryBuilderTest extends TestCase
{

public function testGetHash()
{
//
}
}

0 comments on commit aafcfe1

Please sign in to comment.