mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-07-31 12:10:10 +02:00
PHP7 FluentInterface
This commit is contained in:
@@ -4,19 +4,15 @@ namespace DesignPatterns\Structural\FluentInterface\Tests;
|
||||
|
||||
use DesignPatterns\Structural\FluentInterface\Sql;
|
||||
|
||||
/**
|
||||
* FluentInterfaceTest tests the fluent interface SQL.
|
||||
*/
|
||||
class FluentInterfaceTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testBuildSQL()
|
||||
{
|
||||
$instance = new Sql();
|
||||
$query = $instance->select(array('foo', 'bar'))
|
||||
$query = (new Sql())
|
||||
->select(['foo', 'bar'])
|
||||
->from('foobar', 'f')
|
||||
->where('f.bar = ?')
|
||||
->getQuery();
|
||||
->where('f.bar = ?');
|
||||
|
||||
$this->assertEquals('SELECT foo,bar FROM foobar AS f WHERE f.bar = ?', $query);
|
||||
$this->assertEquals('SELECT foo, bar FROM foobar AS f WHERE f.bar = ?', (string) $query);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user