gravatar bug fixes

This commit is contained in:
sujitprasad
2015-12-01 16:45:35 +05:30
parent 8806809114
commit 29c1cd1826
47 changed files with 5295 additions and 3 deletions

View File

View File

@@ -0,0 +1,56 @@
<?php namespace Chumper\Datatable\Columns;
use Carbon\Carbon;
use Mockery;
class DateColumnTest extends \PHPUnit_Framework_TestCase {
public function testAll()
{
$c = Mockery::mock('Carbon\Carbon');
$column1 = new DateColumn('foo', DateColumn::DATE, 'foo');
$c->shouldReceive('toDateString')
->withNoArgs()->once()
->andReturn('fooBar');
$column2 = new DateColumn('foo', DateColumn::TIME, 'foo');
$c->shouldReceive('toTimeString')
->withNoArgs()->once()
->andReturn('fooBar');
$column3 = new DateColumn('foo', DateColumn::DATE_TIME, 'foo');
$c->shouldReceive('toDateTimeString')
->withNoArgs()->once()
->andReturn('fooBar');
$column4 = new DateColumn('foo', DateColumn::CUSTOM, 'foo');
$c->shouldReceive('format')
->with('foo')->once()
->andReturn('fooBar');
$column5 = new DateColumn('foo', DateColumn::FORMATTED_DATE, 'foo');
$c->shouldReceive('toFormattedDateString')
->withNoArgs()->once()
->andReturn('fooBar');
$column6 = new DateColumn('foo', DateColumn::DAY_DATE, 'foo');
$c->shouldReceive('toDayDateTimeString')
->withNoArgs()->once()
->andReturn('fooBar');
//now test
$this->assertEquals('fooBar', $column1->run(array('foo' => $c)));
$this->assertEquals('fooBar', $column2->run(array('foo' => $c)));
$this->assertEquals('fooBar', $column3->run(array('foo' => $c)));
$this->assertEquals('fooBar', $column4->run(array('foo' => $c)));
$this->assertEquals('fooBar', $column5->run(array('foo' => $c)));
$this->assertEquals('fooBar', $column6->run(array('foo' => $c)));
}
protected function tearDown()
{
Mockery::close();
}
}

View File

@@ -0,0 +1,31 @@
<?php
use Chumper\Datatable\Columns\FunctionColumn;
class FunctionColumnTest extends PHPUnit_Framework_TestCase {
public function testSimple()
{
$column = new FunctionColumn('foo',function($model){
return "FooBar";
});
$this->assertEquals('FooBar', $column->run(array()));
}
public function testAdvanced()
{
$column = new FunctionColumn('foo',function($model){
return $model['text'];
});
$this->assertEquals('FooBar', $column->run(array('text' => 'FooBar')));
}
public function testAdvanced2()
{
$column = new FunctionColumn('foo',function($model){
return $model['text'].'Bar';
});
$this->assertEquals('FooBar', $column->run(array('text' => 'Foo')));
}
}

View File

@@ -0,0 +1,13 @@
<?php
use Chumper\Datatable\Columns\TextColumn;
class TextColumnTest extends PHPUnit_Framework_TestCase {
public function testWorking()
{
$column = new TextColumn('foo', 'FooBar');
$this->assertEquals('FooBar', $column->run(array()));
}
}

View File

@@ -0,0 +1,61 @@
<?php
use Chumper\Datatable\Datatable;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Config;
class DatatableTest extends \Orchestra\Testbench\TestCase {
/**
* @var Datatable
*/
private $dt;
public function setUp()
{
parent::setUp();
// set up config
Config::shouldReceive('get')->zeroOrMoreTimes()->with("chumper.datatable.engine")->andReturn(
array(
'exactWordSearch' => false,
)
);
Config::shouldReceive('get')->zeroOrMoreTimes()->with("chumper.datatable.classmap.QueryEngine",NULL)->andReturn('Chumper\Datatable\Engines\QueryEngine');
Config::shouldReceive('get')->zeroOrMoreTimes()->with("chumper.datatable.classmap.CollectionEngine",NULL)->andReturn('Chumper\Datatable\Engines\CollectionEngine');
Config::shouldReceive('get')->zeroOrMoreTimes()->with("chumper.datatable.classmap.Table",NULL)->andReturn('Chumper\Datatable\Table');
Config::shouldReceive('get')->zeroOrMoreTimes()->with("chumper.datatable.table")->andReturn(
array(
'class' => 'table table-bordered',
'id' => '',
'options' => array(
"sPaginationType" => "full_numbers",
"bProcessing" => false
),
'callbacks' => array(),
'noScript' => false,
'table_view' => 'datatable::template',
'script_view' => 'datatable::javascript',
)
);
$this->dt = new Datatable;
$this->mock = Mockery::mock('Illuminate\Database\Query\Builder');
}
public function testReturnInstances()
{
$api = $this->dt->query($this->mock);
$this->assertInstanceOf('Chumper\Datatable\Engines\QueryEngine', $api);
$api = $this->dt->collection(new Collection());
$this->assertInstanceOf('Chumper\Datatable\Engines\CollectionEngine', $api);
$table = $this->dt->table();
$this->assertInstanceOf('Chumper\Datatable\Table', $table);
}
}

View File

@@ -0,0 +1,113 @@
<?php
use Chumper\Datatable\Engines\CollectionEngine;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Input;
use Orchestra\Testbench\TestCase;
use Illuminate\Support\Facades\Config;
class BaseEngineTest extends TestCase {
private $collection;
/**
* @var CollectionEngine
*/
private $engine;
public function setUp()
{
// set up config
Config::shouldReceive('get')->zeroOrMoreTimes()->with("chumper.datatable.engine")->andReturn(
array(
'exactWordSearch' => false,
)
);
$this->collection = new Collection();
$this->engine = new CollectionEngine($this->collection);
}
/**
* @expectedException Exception
*/
public function testAddColumn()
{
$this->engine->addColumn('foo', 'bar');
$this->assertInstanceOf(
'Chumper\Datatable\Columns\TextColumn',
$this->engine->getColumn('foo')
);
$this->engine->addColumn('foo2', function($model){return $model->fooBar;});
$this->assertInstanceOf(
'Chumper\Datatable\Columns\FunctionColumn',
$this->engine->getColumn('foo2')
);
$this->assertEquals(array(1 => 'foo2', 0 => 'foo'), $this->engine->getOrder());
$this->engine->addColumn();
}
public function testClearColumns()
{
$this->engine->addColumn('foo','Bar');
$this->assertInstanceOf(
'Chumper\Datatable\Columns\TextColumn',
$this->engine->getColumn('foo')
);
$this->engine->clearColumns();
$this->assertEquals(array(), $this->engine->getOrder());
}
public function testSearchColumns()
{
$this->engine->searchColumns('id');
$this->assertEquals(array('id'), $this->engine->getSearchingColumns());
$this->engine->searchColumns('name', 'email');
$this->assertEquals(array('name','email'), $this->engine->getSearchingColumns());
$this->engine->searchColumns(array('foo', 'bar'));
$this->assertEquals(array('foo', 'bar'), $this->engine->getSearchingColumns());
}
public function testOrderColumns()
{
$this->engine->orderColumns('id');
$this->assertEquals(array('id'), $this->engine->getOrderingColumns());
$this->engine->orderColumns('name', 'email');
$this->assertEquals(array('name','email'), $this->engine->getOrderingColumns());
$this->engine->orderColumns(array('foo', 'bar'));
$this->assertEquals(array('foo', 'bar'), $this->engine->getOrderingColumns());
}
public function testShowColumns()
{
$this->engine->showColumns('id');
$this->assertEquals(array('id'), $this->engine->getOrder());
$this->engine->showColumns('name', 'email');
$this->assertEquals(array('id','name','email'), $this->engine->getOrder());
$this->engine->showColumns(array('foo', 'bar'));
$this->assertEquals(array('id','name','email', 'foo', 'bar'), $this->engine->getOrder());
}
}

View File

@@ -0,0 +1,328 @@
<?php
use Chumper\Datatable\Columns\FunctionColumn;
use Chumper\Datatable\Engines\CollectionEngine;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Input;
use Orchestra\Testbench\TestCase;
use Illuminate\Support\Facades\Config;
class CollectionEngineTest extends TestCase {
/**
* @var CollectionEngine
*/
public $c;
/**
* @var \Mockery\Mock
*/
public $collection;
/**
* @var
*/
private $input;
protected function getEnvironmentSetUp($app)
{
$app['config']->set('chumper.datatable.engine', array(
'exactWordSearch' => false,
));
}
public function setUp()
{
parent::setUp();
$this->collection = Mockery::mock('Illuminate\Support\Collection');
$this->c = new CollectionEngine($this->collection);
}
public function testOrder()
{
$should = array(
array(
'id' => 'eoo'
),
array(
'id' => 'foo'
)
);
Input::replace(
array(
'iSortCol_0' => 0,
'sSortDir_0' => 'asc',
)
);
$engine = new CollectionEngine(new Collection($this->getTestArray()));
$engine->addColumn(new FunctionColumn('id', function($model){return $model['id'];}));
$engine->setAliasMapping();
$this->assertEquals($should, $engine->getArray());
Input::merge(
array(
'iSortCol_0' => 0,
'sSortDir_0' => 'desc'
)
);
$should2 = array(
array(
'id' => 'foo'
),
array(
'id' => 'eoo'
)
);
$this->assertEquals($should2, $engine->getArray());
}
public function testSearch()
{
// Facade expection
Input::replace(
array(
'sSearch' => 'eoo'
)
);
$engine = new CollectionEngine(new Collection($this->getTestArray()));
$engine->addColumn($this->getTestColumns());
$engine->searchColumns('id');
$engine->setAliasMapping();
$should = '{"aaData":[{"id":"eoo"}],"sEcho":0,"iTotalRecords":2,"iTotalDisplayRecords":1}';
$actual = $engine->make()->getContent();
$this->assertEquals($should,$actual);
//------------------TEST 2-----------------
// search in outputed data
$engine = new CollectionEngine(new Collection(array(array('foo', 'foo2', 'foo3'),array('bar', 'bar2', 'bar3'))));
$engine->addColumn(new FunctionColumn('bla', function($row){return $row[0]." - ".$row[1];}));
$engine->addColumn(new FunctionColumn('1', function($row){return $row[2];}));
$engine->addColumn(new FunctionColumn('bla3', function($row){return $row[0]." - ".$row[2];}));
$engine->searchColumns("bla",1);
$engine->setAliasMapping();
Input::replace(
array(
'sSearch' => 'foo2'
)
);
$should = array(
array(
'bla' => 'foo - foo2',
'1' => 'foo3',
'bla3' => 'foo - foo3'
)
);
$response = json_decode($engine->make()->getContent());
$this->assertEquals(json_encode($should), json_encode((array)($response->aaData)));
//------------------TEST 3-----------------
// search in initial data
// TODO: Search in initial data columns?
$engine = new CollectionEngine(new Collection(array(array('foo', 'foo2', 'foo3'),array('bar', 'bar2', 'bar3'))));
$engine->addColumn(new FunctionColumn('bla3', function($row){return $row[0]." - ".$row[2];}));
$engine->addColumn(new FunctionColumn('1', function($row){return $row[1];}));
$engine->searchColumns("bla3",1);
$engine->setAliasMapping();
Input::replace(
array(
'sSearch' => 'foo2'
)
);
$should = array(
array(
'bla3' => 'foo - foo3',
'1' => 'foo2'
)
);
$response = json_decode($engine->make()->getContent());
$this->assertEquals(json_encode($should), json_encode($response->aaData));
}
public function testSkip()
{
$engine = new CollectionEngine(new Collection($this->getTestArray()));
$engine->addColumn($this->getTestColumns());
$engine->setAliasMapping();
Input::replace(
array(
'iDisplayStart' => 1
)
);
$should = array(
array(
'id' => 'eoo',
)
);
$this->assertEquals($should, $engine->getArray());
}
public function testTake()
{
Input::replace(
array(
'iDisplayLength' => 1
)
);
$engine = new CollectionEngine(new Collection($this->getTestArray()));
$engine->addColumn($this->getTestColumns());
$engine->setAliasMapping();
$engine->make();
$should = array(
array(
'id' => 'foo',
)
);
$this->assertEquals($should, $engine->getArray());
}
public function testComplex()
{
$engine = new CollectionEngine(new Collection($this->getRealArray()));
$this->addRealColumns($engine);
$engine->searchColumns('foo','bar');
$engine->setAliasMapping();
Input::replace(
array(
'sSearch' => 't'
)
);
$test = json_decode($engine->make()->getContent());
$test = $test->aaData;
$this->assertTrue($this->arrayHasKeyValue('foo','Nils',(array) $test));
$this->assertTrue($this->arrayHasKeyValue('foo','Taylor',(array) $test));
//Test2
$engine = new CollectionEngine(new Collection($this->getRealArray()));
$this->addRealColumns($engine);
$engine->searchColumns('foo','bar');
$engine->setAliasMapping();
Input::replace(
array(
'sSearch' => 'plasch'
)
);
$test = json_decode($engine->make()->getContent());
$test = $test->aaData;
$this->assertTrue($this->arrayHasKeyValue('foo','Nils',(array) $test));
$this->assertFalse($this->arrayHasKeyValue('foo','Taylor',(array) $test));
//test3
$engine = new CollectionEngine(new Collection($this->getRealArray()));
$this->addRealColumns($engine);
$engine->searchColumns('foo','bar');
$engine->setAliasMapping();
Input::replace(
array(
'sSearch' => 'tay'
)
);
$test = json_decode($engine->make()->getContent());
$test = $test->aaData;
$this->assertFalse($this->arrayHasKeyValue('foo','Nils',(array) $test));
$this->assertTrue($this->arrayHasKeyValue('foo','Taylor',(array) $test));
//test4
$engine = new CollectionEngine(new Collection($this->getRealArray()));
$this->addRealColumns($engine);
$engine->searchColumns('foo','bar');
$engine->setAliasMapping();
Input::replace(
array(
'sSearch' => 'O'
)
);
$test = json_decode($engine->make()->getContent());
$test = $test->aaData;
$this->assertFalse($this->arrayHasKeyValue('foo','Nils',(array) $test));
$this->assertTrue($this->arrayHasKeyValue('foo','Taylor',(array) $test));
}
public function tearDown()
{
Mockery::close();
}
private function getTestArray()
{
return array(
array(
'id' => 'foo'
),
array(
'id' => 'eoo'
)
);
}
private function getRealArray()
{
return array(
array(
'name' => 'Nils Plaschke',
'email'=> 'github@nilsplaschke.de'
),
array(
'name' => 'Taylor Otwell',
'email'=> 'taylorotwell@gmail.com'
)
);
}
private function addRealColumns($engine)
{
$engine->addColumn(new FunctionColumn('foo', function($m){return $m['name'];}));
$engine->addColumn(new FunctionColumn('bar', function($m){return $m['email'];}));
}
private function getTestColumns()
{
return new FunctionColumn('id', function($row){return $row['id'];});
}
private function arrayHasKeyValue($key,$value,$array)
{
$array = array_pluck($array,$key);
foreach ($array as $val)
{
if(str_contains($val, $value))
return true;
}
return false;
}
}

View File

@@ -0,0 +1,251 @@
<?php
use Chumper\Datatable\Columns\FunctionColumn;
use Chumper\Datatable\Engines\BaseEngine;
use Chumper\Datatable\Engines\EngineInterface;
use Chumper\Datatable\Engines\QueryEngine;
use Illuminate\Support\Collection;
class QueryEngineTest extends PHPUnit_Framework_TestCase {
/**
* @var QueryEngine
*/
public $c;
/**
* @var \Mockery\Mock
*/
public $builder;
public function setUp()
{
Config::shouldReceive('get')->zeroOrMoreTimes()->with("chumper.datatable.engine")->andReturn(
array(
'exactWordSearch' => false,
)
);
$this->builder = Mockery::mock('Illuminate\Database\Query\Builder');
$this->c = new QueryEngine($this->builder);
}
public function testOrder()
{
$this->builder->shouldReceive('orderBy')->with('id', BaseEngine::ORDER_ASC);
Input::merge(
array(
'iSortCol_0' => 0,
'sSortDir_0' => 'asc'
)
);
//--
$this->builder->shouldReceive('orderBy')->with('id', BaseEngine::ORDER_DESC);
Input::merge(
array(
'iSortCol_0' => 0,
'sSortDir_0' => 'desc'
)
);
}
public function testSearch()
{
$this->builder->shouldReceive('where')->withAnyArgs()->andReturn($this->builder);
$this->builder->shouldReceive('get')->once()->andReturn(new Collection($this->getRealArray()));
$this->builder->shouldReceive('count')->twice()->andReturn(10);
$this->builder->shouldReceive('orderBy')->withAnyArgs()->andReturn($this->builder);
$this->c = new QueryEngine($this->builder);
$this->addRealColumns($this->c);
$this->c->searchColumns('foo');
Input::merge(
array(
'sSearch' => 'test'
)
);
$test = json_decode($this->c->make()->getContent());
$test = $test->aaData;
}
public function testSkip()
{
$this->builder->shouldReceive('skip')->once()->with(1)->andReturn($this->builder);
$this->builder->shouldReceive('get')->once()->andReturn(new Collection($this->getRealArray()));
$this->builder->shouldReceive('count')->twice()->andReturn(10);
$this->builder->shouldReceive('orderBy')->withAnyArgs()->andReturn($this->builder);
$this->c = new QueryEngine($this->builder);
$this->addRealColumns($this->c);
Input::merge(
array(
'iDisplayStart' => 1,
'sSearch' => null
)
);
$this->c->searchColumns('foo');
$test = json_decode($this->c->make()->getContent());
$test = $test->aaData;
}
public function testTake()
{
$this->builder->shouldReceive('take')->once()->with(1)->andReturn($this->builder);
$this->builder->shouldReceive('get')->once()->andReturn(new Collection($this->getRealArray()));
$this->builder->shouldReceive('count')->twice()->andReturn(10);
$this->builder->shouldReceive('orderBy')->withAnyArgs()->andReturn($this->builder);
$this->c = new QueryEngine($this->builder);
$this->addRealColumns($this->c);
Input::merge(
array(
'iDisplayLength' => 1,
'sSearch' => null,
'iDisplayStart' => null
)
);
$this->c->searchColumns('foo');
$test = json_decode($this->c->make()->getContent());
$test = $test->aaData;
}
public function testComplex()
{
$this->builder->shouldReceive('get')->andReturn(new Collection($this->getRealArray()));
$this->builder->shouldReceive('where')->withAnyArgs()->andReturn($this->builder);
$this->builder->shouldReceive('count')->times(8)->andReturn(10);
$engine = new QueryEngine($this->builder);
$this->addRealColumns($engine);
$engine->searchColumns('foo','bar');
$engine->setAliasMapping();
Input::replace(
array(
'sSearch' => 't',
)
);
$test = json_decode($engine->make()->getContent());
$test = $test->aaData;
$this->assertTrue($this->arrayHasKeyValue('foo','Nils',$test));
$this->assertTrue($this->arrayHasKeyValue('foo','Taylor',$test));
//Test2
$engine = new QueryEngine($this->builder);
$this->addRealColumns($engine);
$engine->searchColumns('foo','bar');
$engine->setAliasMapping();
Input::replace(
array(
'sSearch' => 'plasch',
)
);
$test = json_decode($engine->make()->getContent());
$test = $test->aaData;
$this->assertTrue($this->arrayHasKeyValue('foo','Nils',$test));
$this->assertTrue($this->arrayHasKeyValue('foo','Taylor',$test));
//test3
$engine = new QueryEngine($this->builder);
$this->addRealColumns($engine);
$engine->searchColumns('foo','bar');
$engine->setAliasMapping();
Input::replace(
array(
'sSearch' => 'tay',
)
);
$test = json_decode($engine->make()->getContent());
$test = $test->aaData;
$this->assertTrue($this->arrayHasKeyValue('foo','Nils',$test));
$this->assertTrue($this->arrayHasKeyValue('foo','Taylor',$test));
//test4
$engine = new QueryEngine($this->builder);
$this->addRealColumns($engine);
$engine->searchColumns('foo','bar');
$engine->setAliasMapping();
Input::replace(
array(
'sSearch' => '0',
)
);
$test = json_decode($engine->make()->getContent());
$test = $test->aaData;
$this->assertTrue($this->arrayHasKeyValue('foo','Nils',$test));
$this->assertTrue($this->arrayHasKeyValue('foo','Taylor',$test));
}
protected function tearDown()
{
Mockery::close();
}
private function getRealArray()
{
return array(
array(
'name' => 'Nils Plaschke',
'email'=> 'github@nilsplaschke.de'
),
array(
'name' => 'Taylor Otwell',
'email'=> 'taylorotwell@gmail.com'
)
);
}
private function addRealColumns($engine)
{
$engine->addColumn(new FunctionColumn('foo', function($m){return $m['name'];}));
$engine->addColumn(new FunctionColumn('bar', function($m){return $m['email'];}));
}
private function arrayHasKeyValue($key,$value,$array)
{
$array = array_pluck($array,$key);
foreach ($array as $val)
{
if(str_contains($val, $value))
return true;
}
return false;
}
}

View File

@@ -0,0 +1,179 @@
<?php
use Chumper\Datatable\Table;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Request;
use Illuminate\Support\Facades\View;
use Orchestra\Testbench\TestCase;
class TableTest extends TestCase {
/**
* @var Table
*/
private $table;
protected function getEnvironmentSetUp($app)
{
$app['config']->set('chumper.datatable.table', array(
'class' => 'table table-bordered',
'id' => '',
'options' => array(
"sPaginationType" => "full_numbers",
"bProcessing" => false
),
'callbacks' => array(),
'noScript' => false,
'table_view' => 'datatable::template',
'script_view' => 'datatable::javascript',
));
}
public function setUp()
{
parent::setUp();
$this->table = new Table();
}
/**
* @expectedException Exception
*/
public function testSetOptions()
{
$this->table->setOptions('foo','bar');
$this->table->setOptions(array(
'foo2' => 'bar2',
'foo3' => 'bar3'
));
$this->table->setOptions('foo', 'bar', 'baz');
}
/**
* @expectedException Exception
*/
public function testSetCallbacks()
{
$this->table->setCallbacks('foo', 'bar');
$this->assertArrayHasKey('foo', $this->table->getCallbacks());
$this->table->setCallbacks(array(
'foo2' => 'bar2',
'foo3' => 'bar3'
));
$this->assertArrayHasKey('foo2', $this->table->getCallbacks());
$this->assertArrayHasKey('foo3', $this->table->getCallbacks());
$this->table->setCallbacks('foo', 'bar', 'baz');
$this->assertTrue(False); // should throw exception before here
}
public function testSetNamedFunctionAsCallback()
{
//set an anonymous function
$this->table->setCallbacks(['foo'=>'function(){ return foo; }']);
//set a named function
$this->table->setCallbacks(['bar'=>'myBar']);
$parameters = $this->table->getViewParameters();
//an anonymous function should be included as it is.
$this->assertThat($parameters['options'],$this->stringContains('"foo":function(){ return foo; }') );
//the callback it's a function name, it shouldn't be quoted
$this->assertThat($parameters['options'],$this->stringContains('"bar":myBar') );
}
/**
* @expectedException Exception
*/
public function testSetCustomValues()
{
$this->table->setCustomValues('foo', 'bar');
$this->assertArrayHasKey('foo', $this->table->getCustomValues());
$this->table->setCustomValues(array(
'foo2' => 'bar2',
'foo3' => 'bar3'
));
$this->assertArrayHasKey('foo2', $this->table->getCustomValues());
$this->assertArrayHasKey('foo3', $this->table->getCustomValues());
$this->table->setCustomValues('foo', 'bar', 'baz');
$this->assertTrue(False); // should throw exception before here
}
public function testAddColumn()
{
$this->table->addColumn('foo');
$this->assertEquals(1, $this->table->countColumns());
$this->table->addColumn('foo1','foo2');
$this->assertEquals(3, $this->table->countColumns());
$this->table->addColumn(array('foo3','foo4'));
$this->assertEquals(5, $this->table->countColumns());
}
public function testRender()
{
View::shouldReceive('make')->once()
->with('datatable::template', \Mockery::any())->andReturn(true);
$this->table->setUrl('fooBar');
$table1 = $this->table->addColumn('foo')->render();
$this->assertEquals(array(
'options' => '{ "sPaginationType":"full_numbers",'.PHP_EOL
. '"bProcessing":false,'.PHP_EOL
. '"sAjaxSource":"fooBar",'.PHP_EOL
. '"bServerSide":true }',
'values' => array(),
'data' => array(),
'columns' => array(1=>'foo'),
'noScript' => false,
'class' => $this->table->getClass(),
'id' => $this->table->getId(),
), $this->table->getViewParameters());
$this->assertTrue($table1);
}
public function testSetData()
{
$data = array(
array(
'foo',
'bar'
),
array(
'foo2',
'bar2'
),
);
$this->table->setData($data);
$this->assertEquals($data,$this->table->getData());
}
public function testSetUrl()
{
$this->table->setUrl('foo/url');
$this->assertArrayHasKey('bServerSide',$this->table->getOptions());
$this->assertArrayHasKey('sAjaxSource',$this->table->getOptions());
$return = $this->table->getOptions();
$this->assertEquals('foo/url',$return['sAjaxSource']);
}
public function tearDown()
{
Mockery::close();
}
}