gravatar bug fixes
This commit is contained in:
56
code/vendor/chumper/datatable/tests/Columns/DateColumnTest.php
vendored
Normal file
56
code/vendor/chumper/datatable/tests/Columns/DateColumnTest.php
vendored
Normal 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();
|
||||
}
|
||||
}
|
||||
|
||||
31
code/vendor/chumper/datatable/tests/Columns/FunctionColumnTest.php
vendored
Normal file
31
code/vendor/chumper/datatable/tests/Columns/FunctionColumnTest.php
vendored
Normal 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')));
|
||||
}
|
||||
|
||||
}
|
||||
13
code/vendor/chumper/datatable/tests/Columns/TextColumnTest.php
vendored
Normal file
13
code/vendor/chumper/datatable/tests/Columns/TextColumnTest.php
vendored
Normal 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()));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user