Update v1.0.6
This commit is contained in:
@@ -1,56 +0,0 @@
|
||||
<?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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
<?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')));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
<?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()));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user