Skip to content

Commit

Permalink
Apply style fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
leomarquine committed Oct 25, 2017
1 parent 493899a commit b3b0455
Show file tree
Hide file tree
Showing 20 changed files with 98 additions and 76 deletions.
8 changes: 4 additions & 4 deletions tests/Database/ConnectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,25 +28,25 @@ protected function setUp()
}

/** @test */
function get_a_new_query_instance()
public function get_a_new_query_instance()
{
$this->assertInstanceOf(Query::class, $this->connection->query());
}

/** @test */
function get_a_new_statement_instance()
public function get_a_new_statement_instance()
{
$this->assertInstanceOf(Statement::class, $this->connection->statement());
}

/** @test */
function get_a_new_transaction_instance()
public function get_a_new_transaction_instance()
{
$this->assertInstanceOf(Transaction::class, $this->connection->transaction(true));
}

/** @test */
function dynamically_pass_method_calls_to_the_pdo_instance()
public function dynamically_pass_method_calls_to_the_pdo_instance()
{
$this->pdo->shouldReceive('method')->once()->with('param');

Expand Down
2 changes: 1 addition & 1 deletion tests/Database/ManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class ManagerTest extends TestCase
use MockeryPHPUnitIntegration;

/** @test */
function create_a_new_connection()
public function create_a_new_connection()
{
Etl::addConnection([
'driver' => 'sqlite',
Expand Down
20 changes: 10 additions & 10 deletions tests/Database/QueryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ protected function setUp()
}

/** @test */
function select()
public function select()
{
$query = new Query($this->connection);
$query->select('users');
Expand All @@ -40,7 +40,7 @@ function select()
}

/** @test */
function insert()
public function insert()
{
$query = new Query($this->connection);
$query->insert('users', ['name' => 'Jane Doe', 'email' => 'janedoe@example.com']);
Expand All @@ -50,7 +50,7 @@ function insert()
}

/** @test */
function update()
public function update()
{
$query = new Query($this->connection);
$query->update('users', ['name' => 'Jane Doe', 'email' => 'janedoe@example.com']);
Expand All @@ -60,7 +60,7 @@ function update()
}

/** @test */
function delete()
public function delete()
{
$query = new Query($this->connection);
$query->delete('users');
Expand All @@ -70,7 +70,7 @@ function delete()
}

/** @test */
function where()
public function where()
{
$query = new Query($this->connection);
$query->where(['name' => 'Jane Doe', 'email' => 'janedoe@example.com']);
Expand All @@ -80,7 +80,7 @@ function where()
}

/** @test */
function where_in()
public function where_in()
{
$query = new Query($this->connection);
$query->whereIn('id', ['1', '2']);
Expand All @@ -90,7 +90,7 @@ function where_in()
}

/** @test */
function where_not_in()
public function where_not_in()
{
$query = new Query($this->connection);
$query->whereNotIn('id', ['1', '2']);
Expand All @@ -100,7 +100,7 @@ function where_not_in()
}

/** @test */
function composite_where_in()
public function composite_where_in()
{
$query = new Query($this->connection);
$query->whereIn(['id', 'company'], [['id' => '1', 'company' => '1'], ['id' => '2', 'company' => '1']]);
Expand All @@ -110,7 +110,7 @@ function composite_where_in()
}

/** @test */
function composite_where_not_in()
public function composite_where_not_in()
{
$query = new Query($this->connection);
$query->whereNotIn(['id', 'company'], [['id' => '1', 'company' => '1'], ['id' => '2', 'company' => '1']]);
Expand All @@ -120,7 +120,7 @@ function composite_where_not_in()
}

/** @test */
function execute()
public function execute()
{
$this->connection->shouldReceive('prepare')->once()->with('')->andReturn($this->statement);
$this->statement->shouldReceive('execute')->once()->with([]);
Expand Down
12 changes: 6 additions & 6 deletions tests/Database/StatementTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ protected function setUp()
}

/** @test */
function select()
public function select()
{
$statement = new Statement($this->connection);

Expand All @@ -42,7 +42,7 @@ function select()
}

/** @test */
function insert()
public function insert()
{
$statement = new Statement($this->connection);

Expand All @@ -52,7 +52,7 @@ function insert()
}

/** @test */
function update()
public function update()
{
$statement = new Statement($this->connection);

Expand All @@ -62,7 +62,7 @@ function update()
}

/** @test */
function delete()
public function delete()
{
$statement = new Statement($this->connection);

Expand All @@ -72,7 +72,7 @@ function delete()
}

/** @test */
function where()
public function where()
{
$statement = new Statement($this->connection);

Expand All @@ -82,7 +82,7 @@ function where()
}

/** @test */
function prepare()
public function prepare()
{
$this->connection->shouldReceive('prepare')->once()->with('')->andReturn($this->statement);

Expand Down
35 changes: 23 additions & 12 deletions tests/Database/TransactionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@ protected function setUp()
}

/** @test */
function no_transaction()
public function no_transaction()
{
$data = range(1, 20);
$mode = 'none';
$callback = function ($row) { return $row; };
$callback = function ($row) {
return $row;
};

$this->connection->shouldNotReceive('beginTransaction');
$this->connection->shouldNotReceive('commit');
Expand All @@ -41,11 +43,13 @@ function no_transaction()
}

/** @test */
function single_transaction()
public function single_transaction()
{
$data = range(1, 20);
$mode = 'single';
$callback = function ($row) { return $row; };
$callback = function ($row) {
return $row;
};

$this->connection->shouldReceive('beginTransaction')->once();
$this->connection->shouldReceive('commit')->once();
Expand All @@ -54,11 +58,13 @@ function single_transaction()
}

/** @test */
function transaction_size_is_multiple_of_data_size()
public function transaction_size_is_multiple_of_data_size()
{
$data = range(1, 20);
$mode = 10;
$callback = function ($row) { return $row; };
$callback = function ($row) {
return $row;
};

$this->connection->shouldReceive('beginTransaction')->times(2);
$this->connection->shouldReceive('commit')->times(2);
Expand All @@ -67,11 +73,13 @@ function transaction_size_is_multiple_of_data_size()
}

/** @test */
function transaction_size_is_not_multiple_of_data_size()
public function transaction_size_is_not_multiple_of_data_size()
{
$data = range(1, 17);
$mode = 10;
$callback = function ($row) { return $row; };
$callback = function ($row) {
return $row;
};

$this->connection->shouldReceive('beginTransaction')->times(2);
$this->connection->shouldReceive('commit')->times(2);
Expand All @@ -80,11 +88,13 @@ function transaction_size_is_not_multiple_of_data_size()
}

/** @test */
function transaction_rollback_on_error()
public function transaction_rollback_on_error()
{
$data = range(1, 20);
$mode = 10;
$callback = function () { throw new Exception; };
$callback = function () {
throw new Exception;
};

$this->connection->shouldReceive('beginTransaction')->times(1);
$this->connection->shouldReceive('rollBack')->times(1);
Expand All @@ -95,11 +105,12 @@ function transaction_rollback_on_error()
}

/** @test */
function invalid_transaction_mode_throws_an_exception()
public function invalid_transaction_mode_throws_an_exception()
{
$data = range(1, 20);
$mode = 'invalid';
$callback = function () {};
$callback = function () {
};

$this->expectException(InvalidArgumentException::class);

Expand Down
7 changes: 4 additions & 3 deletions tests/EtlTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
class EtlTest extends TestCase
{
/** @test */
function get_and_set_configuration_options()
public function get_and_set_configuration_options()
{
$this->assertNull(Etl::get('nested.key'));

Expand All @@ -16,7 +16,7 @@ function get_and_set_configuration_options()
}

/** @test */
function add_connection()
public function add_connection()
{
$this->assertNull(Etl::get('connections.default'));
$this->assertNull(Etl::get('connections.mysql'));
Expand All @@ -29,6 +29,7 @@ function add_connection()
}
}

class Etl extends \Marquine\Etl\Etl {
class Etl extends \Marquine\Etl\Etl
{
protected static $config = [];
}
4 changes: 2 additions & 2 deletions tests/Extractors/ArrTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class ArrTest extends TestCase
];

/** @test */
function extracts_data_from_an_array()
public function extracts_data_from_an_array()
{
$extractor = new Arr;

Expand All @@ -23,7 +23,7 @@ function extracts_data_from_an_array()
}

/** @test */
function extracts_specific_columns_from_an_array()
public function extracts_specific_columns_from_an_array()
{
$expected = [
['id' => 1, 'name' => 'John Doe'],
Expand Down
6 changes: 3 additions & 3 deletions tests/Extractors/CsvTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class CsvTest extends TestCase
];

/** @test */
function extracts_data_from_a_csv_file()
public function extracts_data_from_a_csv_file()
{
$extractor = new Csv;

Expand All @@ -23,7 +23,7 @@ function extracts_data_from_a_csv_file()
}

/** @test */
function extracts_data_from_a_csv_file_with_custom_options()
public function extracts_data_from_a_csv_file_with_custom_options()
{
$extractor = new Csv;

Expand All @@ -37,7 +37,7 @@ function extracts_data_from_a_csv_file_with_custom_options()
}

/** @test */
function it_extracts_data_from_a_csv_file_without_a_header_line()
public function it_extracts_data_from_a_csv_file_without_a_header_line()
{
$extractor = new Csv;

Expand Down
2 changes: 1 addition & 1 deletion tests/Extractors/FixedWidthTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class FixedWidthTest extends TestCase
];

/** @test */
function extracts_data_from_a_fixed_width_text_file()
public function extracts_data_from_a_fixed_width_text_file()
{
$extractor = new FixedWidth;

Expand Down
4 changes: 2 additions & 2 deletions tests/Extractors/JsonTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class JsonTest extends TestCase
];

/** @test */
function extracts_data_from_a_json_file()
public function extracts_data_from_a_json_file()
{
$extractor = new Json;

Expand All @@ -23,7 +23,7 @@ function extracts_data_from_a_json_file()
}

/** @test */
function extracts_data_from_a_json_file_with_custom_attributes_path()
public function extracts_data_from_a_json_file_with_custom_attributes_path()
{
$extractor = new Json;

Expand Down

0 comments on commit b3b0455

Please sign in to comment.