Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions tests/ReflectorFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ final class ReflectorFactory
{
public static function create(string $cacheFile): QueryReflector
{
// handle defaults
if (false !== getenv('GITHUB_ACTION')) {
$host = getenv('DBA_HOST') ?: '127.0.0.1';
$user = getenv('DBA_USER') ?: 'root';
Expand All @@ -27,6 +28,10 @@ public static function create(string $cacheFile): QueryReflector

$mode = getenv('DBA_MODE') ?: 'recording';
$reflector = getenv('DBA_REFLECTOR') ?: 'mysqli';

// make env vars available to tests, in case non are defined yet
putenv('DBA_REFLECTOR='.$reflector);

if ('recording' === $mode) {
if ('mysqli' === $reflector) {
$mysqli = @new mysqli($host, $user, $password, $dbname);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
/**
* @extends AbstractServiceAwareRuleTestCase<PdoStatementExecuteMethodRule>
*/
class PdoStatementExecuteMethodRuleTest extends AbstractServiceAwareRuleTestCase
class PdoStatementExecuteMethodRuleMysqliReflectorTest extends AbstractServiceAwareRuleTestCase
{
protected function getRule(): Rule
{
Expand All @@ -18,6 +18,10 @@ protected function getRule(): Rule

public function testParameterErrors(): void
{
if ('mysqli' !== getenv('DBA_REFLECTOR')) {
$this->markTestSkipped('Only works with MysqliReflector');
}

require_once __DIR__.'/data/pdo-stmt-execute-error.php';

$this->analyse([__DIR__.'/data/pdo-stmt-execute-error.php'], [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
/**
* @extends AbstractServiceAwareRuleTestCase<SyntaxErrorInPreparedStatementMethodRule>
*/
class SyntaxErrorInPreparedStatementMethodRuleTest extends AbstractServiceAwareRuleTestCase
class SyntaxErrorInPreparedStatementMethodRuleMysqliReflectorTest extends AbstractServiceAwareRuleTestCase
{
protected function getRule(): Rule
{
Expand All @@ -18,6 +18,10 @@ protected function getRule(): Rule

public function testSyntaxErrorInQueryRule(): void
{
if ('mysqli' !== getenv('DBA_REFLECTOR')) {
$this->markTestSkipped('Only works with MysqliReflector');
}

require_once __DIR__.'/data/syntax-error-in-prepared-statement.php';

$this->analyse([__DIR__.'/data/syntax-error-in-prepared-statement.php'], [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
/**
* @extends AbstractServiceAwareRuleTestCase<SyntaxErrorInPreparedStatementMethodRule>
*/
class SyntaxErrorInPreparedStatementMethodSubclassedRuleTest extends AbstractServiceAwareRuleTestCase
class SyntaxErrorInPreparedStatementMethodSubclassedRuleMysqliReflectorTest extends AbstractServiceAwareRuleTestCase
{
protected function getRule(): Rule
{
Expand All @@ -18,6 +18,10 @@ protected function getRule(): Rule

public function testSyntaxErrorInQueryRule(): void
{
if ('mysqli' !== getenv('DBA_REFLECTOR')) {
$this->markTestSkipped('Only works with MysqliReflector');
}

require_once __DIR__.'/data/syntax-error-in-method-subclassed.php';

$this->analyse([__DIR__.'/data/syntax-error-in-method-subclassed.php'], [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
/**
* @extends AbstractServiceAwareRuleTestCase<SyntaxErrorInQueryFunctionRule>
*/
class SyntaxErrorInQueryFunctionRuleTest extends AbstractServiceAwareRuleTestCase
class SyntaxErrorInQueryFunctionRuleMysqliReflectorTest extends AbstractServiceAwareRuleTestCase
{
protected function getRule(): Rule
{
Expand All @@ -18,6 +18,10 @@ protected function getRule(): Rule

public function testSyntaxErrorInQueryRule(): void
{
if ('mysqli' !== getenv('DBA_REFLECTOR')) {
$this->markTestSkipped('Only works with MysqliReflector');
}

require_once __DIR__.'/data/syntax-error-in-query-function.php';

$this->analyse([__DIR__.'/data/syntax-error-in-query-function.php'], [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
/**
* @extends AbstractServiceAwareRuleTestCase<SyntaxErrorInQueryMethodRule>
*/
class SyntaxErrorInQueryMethodRuleTest extends AbstractServiceAwareRuleTestCase
class SyntaxErrorInQueryMethodRuleMysqliReflectorTest extends AbstractServiceAwareRuleTestCase
{
protected function getRule(): Rule
{
Expand All @@ -18,6 +18,10 @@ protected function getRule(): Rule

public function testSyntaxErrorInQueryRule(): void
{
if ('mysqli' !== getenv('DBA_REFLECTOR')) {
$this->markTestSkipped('Only works with MysqliReflector');
}

require_once __DIR__.'/data/syntax-error-in-query-method.php';

$this->analyse([__DIR__.'/data/syntax-error-in-query-method.php'], [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
/**
* @extends AbstractServiceAwareRuleTestCase<SyntaxErrorInQueryMethodRule>
*/
class SyntaxErrorInQueryMethodSubclassedRuleTest extends AbstractServiceAwareRuleTestCase
class SyntaxErrorInQueryMethodSubclassedRuleMysqliReflectorTest extends AbstractServiceAwareRuleTestCase
{
protected function getRule(): Rule
{
Expand All @@ -18,6 +18,10 @@ protected function getRule(): Rule

public function testSyntaxErrorInQueryRule(): void
{
if ('mysqli' !== getenv('DBA_REFLECTOR')) {
$this->markTestSkipped('Only works with MysqliReflector');
}

require_once __DIR__.'/data/syntax-error-in-method-subclassed.php';

$this->analyse([__DIR__.'/data/syntax-error-in-method-subclassed.php'], [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
/**
* @extends AbstractServiceAwareRuleTestCase<PdoStatementExecuteMethodRule>
*/
class UnresolvablePdoStatementRuleTest extends AbstractServiceAwareRuleTestCase
class UnresolvablePdoStatementRuleMysqliReflectorTest extends AbstractServiceAwareRuleTestCase
{
protected function setUp(): void
{
Expand All @@ -30,6 +30,10 @@ protected function getRule(): Rule

public function testSyntaxErrorInQueryRule(): void
{
if ('mysqli' !== getenv('DBA_REFLECTOR')) {
$this->markTestSkipped('Only works with MysqliReflector');
}

require_once __DIR__.'/data/unresolvable-pdo-statement.php';

$this->analyse([__DIR__.'/data/unresolvable-pdo-statement.php'], [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
/**
* @extends AbstractServiceAwareRuleTestCase<SyntaxErrorInPreparedStatementMethodRule>
*/
class UnresolvablePreparedStatementRuleTest extends AbstractServiceAwareRuleTestCase
class UnresolvablePreparedStatementRuleMysqliReflectorTest extends AbstractServiceAwareRuleTestCase
{
protected function setUp(): void
{
Expand All @@ -30,6 +30,10 @@ protected function getRule(): Rule

public function testSyntaxErrorInQueryRule(): void
{
if ('mysqli' !== getenv('DBA_REFLECTOR')) {
$this->markTestSkipped('Only works with MysqliReflector');
}

require_once __DIR__.'/data/unresolvable-statement.php';

$this->analyse([__DIR__.'/data/unresolvable-statement.php'], [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
/**
* @extends AbstractServiceAwareRuleTestCase<SyntaxErrorInQueryFunctionRule>
*/
class UnresolvableQueryFunctionRuleTest extends AbstractServiceAwareRuleTestCase
class UnresolvableQueryFunctionRuleMysqliReflectorTest extends AbstractServiceAwareRuleTestCase
{
protected function setUp(): void
{
Expand All @@ -30,6 +30,10 @@ protected function getRule(): Rule

public function testSyntaxErrorInQueryRule(): void
{
if ('mysqli' !== getenv('DBA_REFLECTOR')) {
$this->markTestSkipped('Only works with MysqliReflector');
}

require_once __DIR__.'/data/unresolvable-query-in-function.php';

$this->analyse([__DIR__.'/data/unresolvable-query-in-function.php'], [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
/**
* @extends AbstractServiceAwareRuleTestCase<SyntaxErrorInQueryMethodRule>
*/
class UnresolvableQueryMethodRuleTest extends AbstractServiceAwareRuleTestCase
class UnresolvableQueryMethodRuleMysqliReflectorTest extends AbstractServiceAwareRuleTestCase
{
protected function setUp(): void
{
Expand All @@ -30,6 +30,10 @@ protected function getRule(): Rule

public function testSyntaxErrorInQueryRule(): void
{
if ('mysqli' !== getenv('DBA_REFLECTOR')) {
$this->markTestSkipped('Only works with MysqliReflector');
}

require_once __DIR__.'/data/unresolvable-query-in-method.php';

$this->analyse([__DIR__.'/data/unresolvable-query-in-method.php'], [
Expand Down