File tree 1 file changed +5
-13
lines changed
1 file changed +5
-13
lines changed Original file line number Diff line number Diff line change 3
3
namespace Illuminated \Helpers \HelperFunctions \Tests \Db ;
4
4
5
5
use Illuminated \Helpers \HelperFunctions \Tests \TestCase ;
6
- use Mockery ;
7
6
8
7
class DbMysqlVariableTest extends TestCase
9
8
{
10
9
/** @test */
11
10
public function it_returns_false_for_unexisting_mysql_variable ()
12
11
{
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 ();
18
14
19
15
$ this ->assertFalse (db_mysql_variable ('fake ' ));
20
16
}
21
17
22
18
/** @test */
23
19
public function it_returns_value_for_existing_mysql_variable ()
24
20
{
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 ' ]);
32
24
33
25
$ this ->assertEquals ('localhost ' , db_mysql_variable ('hostname ' ));
34
26
}
You can’t perform that action at this time.
0 commit comments