Skip to content

Commit

Permalink
Forgot AdvancedStatementInterface and Fixing a namespace Issue with t…
Browse files Browse the repository at this point in the history
…he tests (#171)
  • Loading branch information
kwhat authored Aug 10, 2022
1 parent 3ef0476 commit 3029492
Show file tree
Hide file tree
Showing 17 changed files with 67 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
max-parallel: 15
matrix:
operating-system: [ubuntu-latest]
php-versions: ['7.2', '7.3', '7.4', '8.0']
php-versions: ['7.2', '7.3', '7.4', '8.0' ]
name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }}
steps:
- name: Checkout
Expand Down
2 changes: 1 addition & 1 deletion src/AdvancedStatement.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use FaaPz\PDO\Clause\JoinInterface;
use FaaPz\PDO\Clause\LimitInterface;

abstract class AdvancedStatement extends AbstractStatement implements StatementInterface
abstract class AdvancedStatement extends AbstractStatement implements AdvancedStatementInterface
{
/** @var array<JoinInterface> $join */
protected $join = [];
Expand Down
44 changes: 44 additions & 0 deletions src/AdvancedStatementInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php

/**
* @license MIT
* @license http://opensource.org/licenses/MIT
*/

namespace FaaPz\PDO;

use FaaPz\PDO\Clause\ConditionalInterface;
use FaaPz\PDO\Clause\JoinInterface;
use FaaPz\PDO\Clause\LimitInterface;

interface AdvancedStatementInterface extends StatementInterface
{
/**
* @param JoinInterface $clause
*
* @return self
*/
public function join(JoinInterface $clause);

/**
* @param ConditionalInterface $clause
*
* @return self
*/
public function where(ConditionalInterface $clause);

/**
* @param string $column
* @param string $direction
*
* @return self
*/
public function orderBy(string $column, string $direction = '');

/**
* @param LimitInterface $limit
*
* @return self
*/
public function limit(LimitInterface $limit);
}
6 changes: 6 additions & 0 deletions src/DatabaseInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,11 @@

interface DatabaseInterface
{
/**
* @param string $dsn
* @param ?string $username
* @param ?string $password
* @param array<int, mixed> $options
*/
public function __construct(string $dsn, ?string $username = null, ?string $password = null, array $options = []);
}
4 changes: 2 additions & 2 deletions src/Statement/SelectInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@

namespace FaaPz\PDO\Statement;

use FaaPz\PDO\StatementInterface;
use FaaPz\PDO\AdvancedStatementInterface;
use FaaPz\PDO\Clause\ConditionalInterface;

interface SelectInterface extends StatementInterface
interface SelectInterface extends AdvancedStatementInterface
{
/**
* @return self
Expand Down
4 changes: 2 additions & 2 deletions src/Statement/UpdateInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@

namespace FaaPz\PDO\Statement;

use FaaPz\PDO\AdvancedStatementInterface;
use FaaPz\PDO\Clause\RawInterface;
use FaaPz\PDO\StatementInterface;

interface UpdateInterface extends StatementInterface
interface UpdateInterface extends AdvancedStatementInterface
{
/**
* @param string $table
Expand Down
2 changes: 1 addition & 1 deletion tests/Clause/ConditionalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @license http://opensource.org/licenses/MIT
*/

namespace FaaPz\PDO\Test;
namespace FaaPz\PDO\Test\Clause;

use FaaPz\PDO\Clause\Conditional;
use FaaPz\PDO\Clause\Method;
Expand Down
2 changes: 1 addition & 1 deletion tests/Clause/GroupingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @license http://opensource.org/licenses/MIT
*/

namespace FaaPz\PDO\Test;
namespace FaaPz\PDO\Test\Clause;

use FaaPz\PDO\Clause\Conditional;
use FaaPz\PDO\Clause\Grouping;
Expand Down
2 changes: 1 addition & 1 deletion tests/Clause/JoinTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @license http://opensource.org/licenses/MIT
*/

namespace FaaPz\PDO\Test;
namespace FaaPz\PDO\Test\Clause;

use FaaPz\PDO\Clause\Conditional;
use FaaPz\PDO\Clause\Grouping;
Expand Down
2 changes: 1 addition & 1 deletion tests/Clause/LimitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @license http://opensource.org/licenses/MIT
*/

namespace FaaPz\PDO\Test;
namespace FaaPz\PDO\Test\Clause;

use FaaPz\PDO\Clause;
use PHPUnit\Framework\TestCase;
Expand Down
2 changes: 1 addition & 1 deletion tests/Clause/MethodTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @license http://opensource.org/licenses/MIT
*/

namespace FaaPz\PDO\Test;
namespace FaaPz\PDO\Test\Clause;

use FaaPz\PDO\Clause\Method;
use FaaPz\PDO\Clause\Raw;
Expand Down
2 changes: 1 addition & 1 deletion tests/Clause/RawTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @license http://opensource.org/licenses/MIT
*/

namespace FaaPz\PDO\Test;
namespace FaaPz\PDO\Test\Clause;

use FaaPz\PDO\Clause\Raw;
use PHPUnit\Framework\TestCase;
Expand Down
2 changes: 1 addition & 1 deletion tests/Statement/CallTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @license http://opensource.org/licenses/MIT
*/

namespace FaaPz\PDO\Test;
namespace FaaPz\PDO\Test\Statement;

use FaaPz\PDO\Clause;
use FaaPz\PDO\Database;
Expand Down
2 changes: 1 addition & 1 deletion tests/Statement/DeleteTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @license http://opensource.org/licenses/MIT
*/

namespace FaaPz\PDO\Test;
namespace FaaPz\PDO\Test\Statement;

use FaaPz\PDO\Clause\Conditional;
use FaaPz\PDO\Clause\Join;
Expand Down
2 changes: 1 addition & 1 deletion tests/Statement/InsertTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @license http://opensource.org/licenses/MIT
*/

namespace FaaPz\PDO\Test;
namespace FaaPz\PDO\Test\Statement;

use FaaPz\PDO\Clause\Raw;
use FaaPz\PDO\Database;
Expand Down
2 changes: 1 addition & 1 deletion tests/Statement/SelectTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @license http://opensource.org/licenses/MIT
*/

namespace FaaPz\PDO\Test;
namespace FaaPz\PDO\Test\Statement;

use FaaPz\PDO\Clause\Conditional;
use FaaPz\PDO\Clause\Join;
Expand Down
2 changes: 1 addition & 1 deletion tests/Statement/UpdateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @license http://opensource.org/licenses/MIT
*/

namespace FaaPz\PDO\Test;
namespace FaaPz\PDO\Test\Statement;

use FaaPz\PDO\Clause\Conditional;
use FaaPz\PDO\Clause\Join;
Expand Down

0 comments on commit 3029492

Please sign in to comment.