Skip to content

Commit

Permalink
IHF: Simplified work with objects.
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitry-ivanov committed Sep 17, 2016
1 parent e82ba2f commit 2f10533
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 11 deletions.
4 changes: 1 addition & 3 deletions tests/db/DbMysqlNowTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ public function it_returns_valid_mysql_now()
{
$mock = m::mock('alias:Illuminate\Support\Facades\DB');
$mock->shouldReceive('selectOne')->withArgs(['select now() as now'])->once()->andReturnUsing(function () {
$object = new StdClass();
$object->now = '2016-09-17 18:49:46';
return $object;
return (object) ['now' => '2016-09-17 18:49:46'];
});

$this->assertEquals('2016-09-17 18:49:46', db_mysql_now());
Expand Down
5 changes: 1 addition & 4 deletions tests/db/DbMysqlVariableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@ public function it_returns_value_for_known_mysql_variable()
->withArgs(['show variables where variable_name = ?', ['hostname']])
->once()
->andReturnUsing(function () {
$object = new StdClass();
$object->Variable_name = 'hostname';
$object->Value = 'localhost';
return $object;
return (object) ['Variable_name' => 'hostname', 'Value' => 'localhost'];
});

$this->assertEquals('localhost', db_mysql_variable('hostname'));
Expand Down
5 changes: 1 addition & 4 deletions tests/json/IsJsonTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,7 @@ public function it_returns_true_with_json_encoded_array_passed()
/** @test */
public function it_returns_true_with_json_encoded_object_passed()
{
$object = new StdClass();
$object->foo = 'bar';
$object->baz = 'bax';
$json = json_encode($object);
$json = json_encode((object) ['foo' => 'bar', 'baz' => 'bax']);
$this->assertTrue(is_json($json));
}

Expand Down

0 comments on commit 2f10533

Please sign in to comment.