Skip to content

Commit ce6e638

Browse files
committed
Mockery 1.0 features used.
1 parent d704958 commit ce6e638

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

tests/HelperFunctions/db/DbMysqlVariableTest.php

+5-13
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,24 @@
33
namespace Illuminated\Helpers\HelperFunctions\Tests\Db;
44

55
use Illuminated\Helpers\HelperFunctions\Tests\TestCase;
6-
use Mockery;
76

87
class DbMysqlVariableTest extends TestCase
98
{
109
/** @test */
1110
public function it_returns_false_for_unexisting_mysql_variable()
1211
{
13-
$mock = Mockery::mock('alias:Illuminate\Support\Facades\DB');
14-
$mock->shouldReceive('selectOne')
15-
->withArgs(['show variables where variable_name = ?', ['fake']])
16-
->once()
17-
->andReturnNull();
12+
$mock = mock('alias:Illuminate\Support\Facades\DB');
13+
$mock->expects()->selectOne('show variables where variable_name = ?', ['fake'])->andReturnNull();
1814

1915
$this->assertFalse(db_mysql_variable('fake'));
2016
}
2117

2218
/** @test */
2319
public function it_returns_value_for_existing_mysql_variable()
2420
{
25-
$mock = Mockery::mock('alias:Illuminate\Support\Facades\DB');
26-
$mock->shouldReceive('selectOne')
27-
->withArgs(['show variables where variable_name = ?', ['hostname']])
28-
->once()
29-
->andReturnUsing(function () {
30-
return (object) ['Variable_name' => 'hostname', 'Value' => 'localhost'];
31-
});
21+
$mock = mock('alias:Illuminate\Support\Facades\DB');
22+
$mock->expects()->selectOne('show variables where variable_name = ?', ['hostname'])
23+
->andReturn((object) ['Variable_name' => 'hostname', 'Value' => 'localhost']);
3224

3325
$this->assertEquals('localhost', db_mysql_variable('hostname'));
3426
}

0 commit comments

Comments
 (0)