Skip to content

Commit 2f10533

Browse files
committed
IHF: Simplified work with objects.
1 parent e82ba2f commit 2f10533

File tree

3 files changed

+3
-11
lines changed

3 files changed

+3
-11
lines changed

tests/db/DbMysqlNowTest.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ public function it_returns_valid_mysql_now()
99
{
1010
$mock = m::mock('alias:Illuminate\Support\Facades\DB');
1111
$mock->shouldReceive('selectOne')->withArgs(['select now() as now'])->once()->andReturnUsing(function () {
12-
$object = new StdClass();
13-
$object->now = '2016-09-17 18:49:46';
14-
return $object;
12+
return (object) ['now' => '2016-09-17 18:49:46'];
1513
});
1614

1715
$this->assertEquals('2016-09-17 18:49:46', db_mysql_now());

tests/db/DbMysqlVariableTest.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,7 @@ public function it_returns_value_for_known_mysql_variable()
2424
->withArgs(['show variables where variable_name = ?', ['hostname']])
2525
->once()
2626
->andReturnUsing(function () {
27-
$object = new StdClass();
28-
$object->Variable_name = 'hostname';
29-
$object->Value = 'localhost';
30-
return $object;
27+
return (object) ['Variable_name' => 'hostname', 'Value' => 'localhost'];
3128
});
3229

3330
$this->assertEquals('localhost', db_mysql_variable('hostname'));

tests/json/IsJsonTest.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,7 @@ public function it_returns_true_with_json_encoded_array_passed()
113113
/** @test */
114114
public function it_returns_true_with_json_encoded_object_passed()
115115
{
116-
$object = new StdClass();
117-
$object->foo = 'bar';
118-
$object->baz = 'bax';
119-
$json = json_encode($object);
116+
$json = json_encode((object) ['foo' => 'bar', 'baz' => 'bax']);
120117
$this->assertTrue(is_json($json));
121118
}
122119

0 commit comments

Comments
 (0)