Skip to content

Commit

Permalink
- updated dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
timopruesse committed Jun 15, 2017
1 parent 50b8575 commit e52a90f
Show file tree
Hide file tree
Showing 17 changed files with 1,236 additions and 3,743 deletions.
8 changes: 3 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,13 @@
}
],
"require": {
"illuminate/support": "~5.1",
"php": "~5.6|~7.0"
"illuminate/support": "5.4.*",
"php": ">=7.1.0"
},
"require-dev": {
"phpunit/phpunit": "~5.7",
"squizlabs/php_codesniffer": "^2.3",
"orchestra/testbench": "~3.0",
"mockery/mockery": "0.9.*",
"phpdocumentor/phpdocumentor": "2.*"
"mockery/mockery": "0.9.*"
},
"autoload": {
"psr-4": {
Expand Down
4,791 changes: 1,141 additions & 3,650 deletions composer.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/Models/DataComponents/Sorter.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public function removeField(string $field) : Sorter
private function _sortField(string $fieldName, string $direction) : void
{
/** @var Column $column */
$column = \array_first($this->_dataTable->getColumns(), function($index, $column) use ($fieldName) {
$column = \array_first($this->_dataTable->getColumns(), function($column) use ($fieldName) {
/** @var Column $column */
return $column->getKey() === $fieldName;
});
Expand Down
2 changes: 1 addition & 1 deletion src/Models/DataTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ public function formatColumn(string $columnName, ColumnFormatter $columnFormatte
/** @var Column $column */
$column = \array_first(
$this->_columns,
function($index, $column) use ($columnName) {
function($column) use ($columnName) {
/** @var Column $column */
return $column->getName() === $columnName;
}
Expand Down
22 changes: 11 additions & 11 deletions tests/ColumnTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ public function name_is_set()
$name = 'testcolumn';
$column = new Column($name);

$this->assertEquals($name, $column->getName());
$this->assertNull($column->getRelation());
static::assertEquals($name, $column->getName());
static::assertNull($column->getRelation());
}

/**
Expand All @@ -31,9 +31,9 @@ public function relation_is_set()
$column = new Column($name);
$relation = $column->getRelation();

$this->assertEquals('column', $column->getName());
$this->assertNotNull($relation);
$this->assertEquals('test_column', $relation->name);
static::assertEquals('column', $column->getName());
static::assertNotNull($relation);
static::assertEquals('test_column', $relation->name);
}

/**
Expand All @@ -45,10 +45,10 @@ public function aggregate_is_set()
$column = new Column($name);
$relation = $column->getRelation();

$this->assertEquals('column', $column->getName());
$this->assertNotNull($relation);
$this->assertEquals('test_column', $relation->name);
$this->assertEquals('count', $relation->aggregate);
static::assertEquals('column', $column->getName());
static::assertNotNull($relation);
static::assertEquals('test_column', $relation->name);
static::assertEquals('count', $relation->aggregate);
}

/**
Expand All @@ -57,7 +57,7 @@ public function aggregate_is_set()
public function can_identify_mutated_attributes()
{
$column = new Column('custom_column', null, new TestModel());
$this->assertTrue($column->isMutated());
$this->assertEquals('custom_column', $column->getAttributeName());
static::assertTrue($column->isMutated());
static::assertEquals('custom_column', $column->getAttributeName());
}
}
24 changes: 12 additions & 12 deletions tests/DataComponentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function after_init_is_called()
$testComponent = new TestDataComponent();
DataTable::model(TestModel::class)->addComponent($testComponent);

$this->assertTrue($testComponent->afterInitCalled);
static::assertTrue($testComponent->afterInitCalled);
}

/**
Expand All @@ -31,8 +31,8 @@ public function remembers_state()
$testComponent->remember();
DataTable::model(TestModel::class)->addComponent($testComponent);

$this->assertTrue($testComponent->afterInitCalled);
$this->assertTrue($testComponent->readFromSessionCalled);
static::assertTrue($testComponent->afterInitCalled);
static::assertTrue($testComponent->readFromSessionCalled);
}

/**
Expand All @@ -44,12 +44,12 @@ public function saves_state()
$testComponent->remember();
$dataTable = DataTable::model(TestModel::class)->addComponent($testComponent);

$this->assertTrue($testComponent->afterInitCalled);
$this->assertTrue($testComponent->readFromSessionCalled);
static::assertTrue($testComponent->afterInitCalled);
static::assertTrue($testComponent->readFromSessionCalled);

$dataTable->render();

$this->assertTrue($testComponent->storeInSessionCalled);
static::assertTrue($testComponent->storeInSessionCalled);
}

/**
Expand All @@ -58,7 +58,7 @@ public function saves_state()
public function is_rendered()
{
$testComponent = new TestDataComponent();
$this->assertEquals('TEST-RENDER', $testComponent->render());
static::assertEquals('TEST-RENDER', $testComponent->render());
}

/**
Expand All @@ -67,7 +67,7 @@ public function is_rendered()
public function component_can_be_accessed_directly()
{
$dataTable = DataTable::model(TestModel::class)->addComponent(new TestDataComponent());
$this->assertInstanceOf(TestDataComponent::class, $dataTable->testdatacomponent);
static::assertInstanceOf(TestDataComponent::class, $dataTable->testdatacomponent);
}

/**
Expand All @@ -76,7 +76,7 @@ public function component_can_be_accessed_directly()
public function component_can_be_added_and_accessed_directly_by_name()
{
$dataTable = DataTable::model(TestModel::class)->addComponent(new TestDataComponent(), 'myawesomecomponent');
$this->assertInstanceOf(TestDataComponent::class, $dataTable->myawesomecomponent);
static::assertInstanceOf(TestDataComponent::class, $dataTable->myawesomecomponent);
}

/**
Expand All @@ -97,7 +97,7 @@ public function normal_properties_are_returned_correctly()
$testValue = 'test';
$dataTable = DataTable::model(TestModel::class);
$dataTable->test = $testValue;
$this->assertEquals($testValue, $dataTable->test);
static::assertEquals($testValue, $dataTable->test);
DataTable::shouldReceive('test')->andReturn($testValue);
}

Expand All @@ -107,8 +107,8 @@ public function normal_properties_are_returned_correctly()
public function can_check_whether_component_exists()
{
$dataTable = DataTable::model(TestModel::class);
$this->assertFalse($dataTable->componentExists('testdatacomponent'));
static::assertFalse($dataTable->componentExists('testdatacomponent'));
$dataTable->addComponent(new TestDataComponent());
$this->assertTrue($dataTable->componentExists('testdatacomponent'));
static::assertTrue($dataTable->componentExists('testdatacomponent'));
}
}
22 changes: 11 additions & 11 deletions tests/DataTableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function empty_data_is_properly_displayed()
$dataTable = DataTable::model(TestModel::class);
$dataTable->query()->where('created_at', '1991-08-03');

$this->assertEquals(
static::assertEquals(
'<div>no data</div>',
$dataTable->render()
);
Expand All @@ -51,7 +51,7 @@ public function renders_custom_no_data()
$dataTable = DataTable::model(TestModel::class)->noDataHtml($html);
$dataTable->query()->where('created_at', '1991-08-03');

$this->assertEquals(
static::assertEquals(
$html,
$dataTable->render()
);
Expand All @@ -67,7 +67,7 @@ public function renders_custom_no_data_for_view()
$dataTable = DataTable::model(TestModel::class)->noDataView('no_data');
$dataTable->query()->where('created_at', '1991-08-03');

$this->assertEquals(
static::assertEquals(
'<div>NO_DATA</div>',
$dataTable->render()
);
Expand All @@ -87,7 +87,7 @@ public function renders_table_correctly()
$dataTable = DataTable::model(TestModel::class, ['id', 'created_at', 'name']);
$dataTable->query()->where('name', 'test');

$this->assertEquals(
static::assertEquals(
'<table class="table"><tr><th>id</th><th>created_at</th><th>name</th></tr><tr><td>' .
$testmodel->id . '</td><td>' .
$testmodel->created_at->format('Y-m-d H:i:s') . '</td><td>' .
Expand All @@ -110,7 +110,7 @@ public function table_has_class()
$dataTable = DataTable::model(TestModel::class, ['id', 'created_at', 'name'])->classes('test-class');
$dataTable->query()->where('name', 'test');

$this->assertEquals(
static::assertEquals(
'<table class="test-class"><tr><th>id</th><th>created_at</th><th>name</th></tr><tr><td>' .
$testmodel->id . '</td><td>' .
$testmodel->created_at->format('Y-m-d H:i:s') . '</td><td>' .
Expand All @@ -132,7 +132,7 @@ public function table_renders_mutated_attributes()
$dataTable = DataTable::model(TestModel::class, ['custom_column']);
$dataTable->query()->where('name', 'test');

$this->assertEquals(
static::assertEquals(
'<table class="table"><tr><th>custom_column</th></tr><tr><td>custom-column</td></tr></table>',
$dataTable->render()
);
Expand Down Expand Up @@ -210,7 +210,7 @@ public function column_formatters_are_set()
$dataTable = DataTable::model(TestModel::class, ['created_at' => new DateColumn($dateFormat)]);
$dataTable->query()->where('name', $fieldName);

$this->assertEquals(
static::assertEquals(
'<table class="table"><tr><th>created_at</th></tr><tr><td>01.01.2017</td></tr></table>',
$dataTable->render()
);
Expand All @@ -230,7 +230,7 @@ public function column_formatters_are_set_when_using_columns_function()
$dataTable = DataTable::model(TestModel::class)->columns(['created_at' => new DateColumn($dateFormat)]);
$dataTable->query()->where('name', $fieldName);

$this->assertEquals(
static::assertEquals(
'<table class="table"><tr><th>created_at</th></tr><tr><td>01.01.2017</td></tr></table>',
$dataTable->render()
);
Expand All @@ -249,7 +249,7 @@ public function relations_are_loaded()
$dataTable = DataTable::model(TestModel::class, ['created_at', 'tester.created_at'])->with(['tester']);
$dataTable->query()->where('testmodels.created_at', $parent->created_at->format('Y-m-d H:i:s'));

$this->assertEquals(
static::assertEquals(
'<table class="table"><tr><th>created_at</th><th>tester_created_at</th></tr><tr><td>2017-01-01 00:00:00</td><td>2017-02-02 00:00:00</td></tr></table>',
$dataTable->render()
);
Expand All @@ -268,7 +268,7 @@ public function many_relations_are_loaded()
$dataTable = DataTable::model(TestModel::class, ['created_at', 'testers.created_at'])->with(['testers']);
$dataTable->query()->where('testmodels.created_at', $parent->created_at->format('Y-m-d H:i:s'));

$this->assertEquals(
static::assertEquals(
'<table class="table"><tr><th>created_at</th><th>testers_created_at</th></tr><tr><td>2017-01-01 00:00:00</td><td>2017-02-02 00:00:00</td></tr></table>',
$dataTable->render()
);
Expand All @@ -288,7 +288,7 @@ public function aggregates_are_considered()
$dataTable = DataTable::model(TestModel::class, ['created_at', 'COUNT(testers.id)'])->with(['testers']);
$dataTable->query()->where('testmodels.created_at', $parent->created_at->format('Y-m-d H:i:s'));

$this->assertEquals(
static::assertEquals(
'<table class="table"><tr><th>created_at</th><th>count_testers_id</th></tr><tr><td>2017-01-01 00:00:00</td><td>2</td></tr></table>',
$dataTable->render()
);
Expand Down
4 changes: 2 additions & 2 deletions tests/DateColumnTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function date_is_formatted_correctly()
$dataTable = DataTable::model(TestModel::class, ['created_at'])->formatColumn('created_at', new DateColumn($dateFormat));
$dataTable->query()->where('name', $fieldName);

$this->assertEquals(
static::assertEquals(
'<table class="table"><tr><th>created_at</th></tr><tr><td>' . Carbon::parse($date)->format($dateFormat) . '</td></tr></table>',
$dataTable->render()
);
Expand All @@ -49,7 +49,7 @@ public function date_is_formatted_when_using_function()

$dateColumn->dateFormat($dateFormat);

$this->assertEquals(
static::assertEquals(
'<table class="table"><tr><th>created_at</th></tr><tr><td>' . Carbon::parse($date)->format($dateFormat) . '</td></tr></table>',
$dataTable->render()
);
Expand Down
4 changes: 2 additions & 2 deletions tests/HeaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public function attribute_name_is_set()
$name = 'testcolumn';
$header = new Header($name);

$this->assertEquals($name, $header->key);
$this->assertEquals($name, $header->getAttributeName());
static::assertEquals($name, $header->key);
static::assertEquals($name, $header->getAttributeName());
}
}
2 changes: 1 addition & 1 deletion tests/IconColumnTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function icon_is_rendered()
$dataTable = DataTable::model(TestModel::class, ['name'])->formatColumn('name', new IconColumn(new FontAwesomeAdapter()));
$dataTable->query()->where('name', $iconName);

$this->assertEquals(
static::assertEquals(
'<table class="table"><tr><th>name</th></tr><tr><td><i class="fa fa-' . $iconName . '"></i></td></tr></table>',
$dataTable->render()
);
Expand Down
Loading

0 comments on commit e52a90f

Please sign in to comment.