Thanks to visit codestin.com
Credit goes to github.com

Skip to content

PHPUnit Tests #201

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 8, 2021
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
16 changes: 8 additions & 8 deletions tests/ConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function testErrorMysqli()
}

$this->expectException(\Exception::class);
$this->expectExceptionMessageRegExp('/[Missing configuration details to connect to database]/');
$this->expectExceptionMessageMatches('/[Missing configuration details to connect to database]/');
$settings = Config::initialize('mysqli', [self::TEST_DB_USER, self::TEST_DB_PASSWORD]);
}

Expand Down Expand Up @@ -88,7 +88,7 @@ public function testErrorPdo()

$dsn = 'mysql:host=' . self::TEST_DB_HOST . ';dbname=' . self::TEST_DB_NAME . ';port=3306';
$this->expectException(\Exception::class);
$this->expectExceptionMessageRegExp('/[Missing configuration details to connect to database]/');
$this->expectExceptionMessageMatches('/[Missing configuration details to connect to database]/');
$settings = Config::initialize('pdo', [$dsn]);
}

Expand All @@ -102,7 +102,7 @@ public function test__callPdo()

$dsn = 'mysql:host=' . self::TEST_DB_HOST . ';dbname=' . self::TEST_DB_NAME . ';port=3306';
$this->expectException(\Exception::class);
$this->expectExceptionMessageRegExp('/[does not exist]/');
$this->expectExceptionMessageMatches('/[does not exist]/');
$settings = new Config('pdo', [$dsn, self::TEST_DB_USER, self::TEST_DB_PASSWORD]);
$settings->getNotAnProperty();
}
Expand Down Expand Up @@ -145,7 +145,7 @@ public function testErrorPgsql()
}

$this->expectException(\Exception::class);
$this->expectExceptionMessageRegExp('/[Missing configuration details to connect to database]/');
$this->expectExceptionMessageMatches('/[Missing configuration details to connect to database]/');
$settings = Config::initialize('pgsql', [self::TEST_DB_USER, self::TEST_DB_PASSWORD]);
}

Expand Down Expand Up @@ -185,7 +185,7 @@ public function testErrorSqlsrv()
}

$this->expectException(\Exception::class);
$this->expectExceptionMessageRegExp('/[Missing configuration details to connect to database]/');
$this->expectExceptionMessageMatches('/[Missing configuration details to connect to database]/');
$settings = new Config('sqlsrv', [self::TEST_DB_USER, self::TEST_DB_PASSWORD]);
}

Expand Down Expand Up @@ -224,21 +224,21 @@ public function testErrorSqlite3()
}

$this->expectException(\Exception::class);
$this->expectExceptionMessageRegExp('/[Missing configuration details to connect to database]/');
$this->expectExceptionMessageMatches('/[Missing configuration details to connect to database]/');
$settings = new Config('sqlite3', [self::TEST_SQLITE_DB_DIR]);
}

public function test_construct()
{
$this->expectException(\Exception::class);
$this->expectExceptionMessageRegExp('/[Missing configuration details to connect to database]/');
$this->expectExceptionMessageMatches('/[Missing configuration details to connect to database]/');
$settings = new Config('', [self::TEST_DB_USER, self::TEST_DB_PASSWORD, self::TEST_DB_NAME]);
}

public function test_constructArgs()
{
$this->expectException(\Exception::class);
$this->expectExceptionMessageRegExp('/[Missing configuration details to connect to database]/');
$this->expectExceptionMessageMatches('/[Missing configuration details to connect to database]/');
$settings = new Config('mysqli');
}
}
4 changes: 2 additions & 2 deletions tests/DInjectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function testAutoWire_Error()
{
$container = new DInjector();
$this->expectException(ContainerException::class);
$this->expectExceptionMessageRegExp('/[is not instantiable]/');
$this->expectExceptionMessageMatches('/[is not instantiable]/');
$baz = $container->autoWire('ezsql\Tests\Baz');
}

Expand All @@ -70,7 +70,7 @@ public function testGet_Error()
{
$container = new DInjector();
$this->expectException(NotFoundException::class);
$this->expectExceptionMessageRegExp('/[does not exists]/');
$this->expectExceptionMessageMatches('/[does not exists]/');
$baz = $container->get('Baz');
}
}
2 changes: 1 addition & 1 deletion tests/DatabaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public function testInitialize_Pdo()
public function testInitialize_Error()
{
$this->expectException(\Exception::class);
$this->expectExceptionMessageRegExp('/[Missing configuration details]/');
$this->expectExceptionMessageMatches('/[Missing configuration details]/');
$mysqli = Database::initialize('', [self::TEST_DB_USER, self::TEST_DB_PASSWORD, self::TEST_DB_NAME]);
}
}
2 changes: 1 addition & 1 deletion tests/ezSchemaTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public function test__call_Error()
$this->assertFalse(column('id', INTR, 32, AUTO, PRIMARY));
$db = mysqlInstance([self::TEST_DB_USER, self::TEST_DB_PASSWORD, self::TEST_DB_NAME]);
$this->expectException(\Exception::class);
$this->expectExceptionMessageRegExp('/[does not exist]/');
$this->expectExceptionMessageMatches('/[does not exist]/');
$this->assertNull(column('id', 'DOS', 32));
}

Expand Down
2 changes: 1 addition & 1 deletion tests/ezsqlModelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function testSetCache_Timeout()
public function testGetNotProperty()
{
$this->expectException(\Exception::class);
$this->expectExceptionMessageRegExp('/does not exist/');
$this->expectExceptionMessageMatches('/does not exist/');
$res = $this->object->getNotProperty();
}

Expand Down
2 changes: 1 addition & 1 deletion tests/mysqli/mysqliTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ public function testQuery_prepared()

public function test__construct_Error()
{
$this->expectExceptionMessageRegExp('/[Missing configuration details]/');
$this->expectExceptionMessageMatches('/[Missing configuration details]/');
$this->assertNull(new ez_mysqli());
}

Expand Down
12 changes: 6 additions & 6 deletions tests/pdo/pdo_mysqlTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -293,9 +293,9 @@ public function testJoins()
$this->object->insert('unit_test', array('id' => '2', 'test_key' => 'testing 2'));
$this->object->insert('unit_test', array('id' => '3', 'test_key' => 'testing 3'));
$this->object->query('CREATE TABLE unit_test_child(child_id integer, child_test_key varchar(50), parent_id integer, PRIMARY KEY (child_id))');
$this->object->insert('unit_test', array('child_id' => '1', 'child_test_key' => 'testing child 1', 'parent_id' => '3'));
$this->object->insert('unit_test', array('child_id' => '2', 'child_test_key' => 'testing child 2', 'parent_id' => '2'));
$this->object->insert('unit_test', array('child_id' => '3', 'child_test_key' => 'testing child 3', 'parent_id' => '1'));
$this->object->insert('unit_test_child', array('child_id' => '1', 'child_test_key' => 'testing child 1', 'parent_id' => '3'));
$this->object->insert('unit_test_child', array('child_id' => '2', 'child_test_key' => 'testing child 2', 'parent_id' => '2'));
$this->object->insert('unit_test_child', array('child_id' => '3', 'child_test_key' => 'testing child 3', 'parent_id' => '1'));

$result = $this->object->selecting('unit_test_child', '*', leftJoin('unit_test_child', 'unit_test', 'parent_id', 'id'));
$i = 1;
Expand All @@ -316,8 +316,8 @@ public function testJoins()
--$o;
}

$this->assertEquals(0, $this->object->query('DROP TABLE unit_test'));
$this->assertEquals(0, $this->object->query('DROP TABLE unit_test_child'));
$this->assertEquals(0, $this->object->drop('unit_test'));
$this->assertEquals(0, $this->object->drop('unit_test_child'));
}

public function testBeginTransactionCommit()
Expand Down Expand Up @@ -443,7 +443,7 @@ public function testQuery_prepared()

public function test__Construct_Error()
{
$this->expectExceptionMessageRegExp('/[Missing configuration details]/');
$this->expectExceptionMessageMatches('/[Missing configuration details]/');
$this->assertNull(new ez_pdo());
}

Expand Down
6 changes: 3 additions & 3 deletions tests/pdo/pdo_pgsqlTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,9 @@ public function testJoins()
$this->object->insert('unit_test', array('id' => '2', 'test_key' => 'testing 2'));
$this->object->insert('unit_test', array('id' => '3', 'test_key' => 'testing 3'));
$this->object->query('CREATE TABLE unit_test_child(child_id integer, child_test_key varchar(50), parent_id integer, PRIMARY KEY (child_id))');
$this->object->insert('unit_test', array('child_id' => '1', 'child_test_key' => 'testing child 1', 'parent_id' => '3'));
$this->object->insert('unit_test', array('child_id' => '2', 'child_test_key' => 'testing child 2', 'parent_id' => '2'));
$this->object->insert('unit_test', array('child_id' => '3', 'child_test_key' => 'testing child 3', 'parent_id' => '1'));
$this->object->insert('unit_test_child', array('child_id' => '1', 'child_test_key' => 'testing child 1', 'parent_id' => '3'));
$this->object->insert('unit_test_child', array('child_id' => '2', 'child_test_key' => 'testing child 2', 'parent_id' => '2'));
$this->object->insert('unit_test_child', array('child_id' => '3', 'child_test_key' => 'testing child 3', 'parent_id' => '1'));

$result = $this->object->selecting('unit_test_child', '*', leftJoin('unit_test_child', 'unit_test', 'parent_id', 'id'));
$i = 1;
Expand Down
6 changes: 3 additions & 3 deletions tests/pdo/pdo_sqliteTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,9 @@ public function testJoins()
$this->object->insert('unit_test', array('id' => '2', 'test_key' => 'testing 2'));
$this->object->insert('unit_test', array('id' => '3', 'test_key' => 'testing 3'));
$this->object->query('CREATE TABLE unit_test_child(child_id integer, child_test_key varchar(50), parent_id integer, PRIMARY KEY (child_id))');
$this->object->insert('unit_test', array('child_id' => '1', 'child_test_key' => 'testing child 1', 'parent_id' => '3'));
$this->object->insert('unit_test', array('child_id' => '2', 'child_test_key' => 'testing child 2', 'parent_id' => '2'));
$this->object->insert('unit_test', array('child_id' => '3', 'child_test_key' => 'testing child 3', 'parent_id' => '1'));
$this->object->insert('unit_test_child', array('child_id' => '1', 'child_test_key' => 'testing child 1', 'parent_id' => '3'));
$this->object->insert('unit_test_child', array('child_id' => '2', 'child_test_key' => 'testing child 2', 'parent_id' => '2'));
$this->object->insert('unit_test_child', array('child_id' => '3', 'child_test_key' => 'testing child 3', 'parent_id' => '1'));

$result = $this->object->selecting('unit_test_child', '*', leftJoin('unit_test_child', 'unit_test', 'parent_id', 'id'));
$i = 1;
Expand Down
6 changes: 3 additions & 3 deletions tests/pdo/pdo_sqlsrvTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,9 @@ public function testJoins()
$this->object->insert('unit_test', array('id' => '2', 'test_key' => 'testing 2'));
$this->object->insert('unit_test', array('id' => '3', 'test_key' => 'testing 3'));
$this->object->query('CREATE TABLE unit_test_child(child_id integer, child_test_key varchar(50), parent_id integer, PRIMARY KEY (child_id))');
$this->object->insert('unit_test', array('child_id' => '1', 'child_test_key' => 'testing child 1', 'parent_id' => '3'));
$this->object->insert('unit_test', array('child_id' => '2', 'child_test_key' => 'testing child 2', 'parent_id' => '2'));
$this->object->insert('unit_test', array('child_id' => '3', 'child_test_key' => 'testing child 3', 'parent_id' => '1'));
$this->object->insert('unit_test_child', array('child_id' => '1', 'child_test_key' => 'testing child 1', 'parent_id' => '3'));
$this->object->insert('unit_test_child', array('child_id' => '2', 'child_test_key' => 'testing child 2', 'parent_id' => '2'));
$this->object->insert('unit_test_child', array('child_id' => '3', 'child_test_key' => 'testing child 3', 'parent_id' => '1'));

$result = $this->object->selecting('unit_test_child', '*', leftJoin('unit_test_child', 'unit_test', 'parent_id', 'id'));
$i = 1;
Expand Down