Skip to content

Commit 33c7b8d

Browse files
committed
IHF: db_is_mysql helper fully covered by tests.
1 parent 5ce4093 commit 33c7b8d

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

tests/db/DbIsMysqlTest.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
use Mockery as m;
4+
5+
class DbIsMysqlTest extends TestCase
6+
{
7+
/** @test */
8+
public function it_returns_true_if_laravel_database_default_connection_is_mysql()
9+
{
10+
$mock = m::mock('alias:Illuminate\Support\Facades\DB');
11+
$mock->shouldReceive('getDefaultConnection')->withNoArgs()->once()->andReturn('mysql');
12+
13+
$this->assertTrue(db_is_mysql());
14+
}
15+
16+
/** @test */
17+
public function it_returns_false_if_laravel_database_default_connection_is_not_mysql()
18+
{
19+
$mock = m::mock('alias:Illuminate\Support\Facades\DB');
20+
$mock->shouldReceive('getDefaultConnection')->withNoArgs()->once()->andReturn('sqlite');
21+
22+
$this->assertFalse(db_is_mysql());
23+
}
24+
}

0 commit comments

Comments
 (0)