Skip to content

Commit 66e82e6

Browse files
authored
Merge pull request #201 from dpDesignz/master
PHPUnit Tests
2 parents 266a28a + 6500f3c commit 66e82e6

File tree

10 files changed

+29
-29
lines changed

10 files changed

+29
-29
lines changed

tests/ConfigTest.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function testErrorMysqli()
4545
}
4646

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

@@ -88,7 +88,7 @@ public function testErrorPdo()
8888

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

@@ -102,7 +102,7 @@ public function test__callPdo()
102102

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

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

@@ -185,7 +185,7 @@ public function testErrorSqlsrv()
185185
}
186186

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

@@ -224,21 +224,21 @@ public function testErrorSqlite3()
224224
}
225225

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

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

238238
public function test_constructArgs()
239239
{
240240
$this->expectException(\Exception::class);
241-
$this->expectExceptionMessageRegExp('/[Missing configuration details to connect to database]/');
241+
$this->expectExceptionMessageMatches('/[Missing configuration details to connect to database]/');
242242
$settings = new Config('mysqli');
243243
}
244244
}

tests/DInjectorTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function testAutoWire_Error()
5252
{
5353
$container = new DInjector();
5454
$this->expectException(ContainerException::class);
55-
$this->expectExceptionMessageRegExp('/[is not instantiable]/');
55+
$this->expectExceptionMessageMatches('/[is not instantiable]/');
5656
$baz = $container->autoWire('ezsql\Tests\Baz');
5757
}
5858

@@ -70,7 +70,7 @@ public function testGet_Error()
7070
{
7171
$container = new DInjector();
7272
$this->expectException(NotFoundException::class);
73-
$this->expectExceptionMessageRegExp('/[does not exists]/');
73+
$this->expectExceptionMessageMatches('/[does not exists]/');
7474
$baz = $container->get('Baz');
7575
}
7676
}

tests/DatabaseTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public function testInitialize_Pdo()
105105
public function testInitialize_Error()
106106
{
107107
$this->expectException(\Exception::class);
108-
$this->expectExceptionMessageRegExp('/[Missing configuration details]/');
108+
$this->expectExceptionMessageMatches('/[Missing configuration details]/');
109109
$mysqli = Database::initialize('', [self::TEST_DB_USER, self::TEST_DB_PASSWORD, self::TEST_DB_NAME]);
110110
}
111111
}

tests/ezSchemaTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public function test__call_Error()
104104
$this->assertFalse(column('id', INTR, 32, AUTO, PRIMARY));
105105
$db = mysqlInstance([self::TEST_DB_USER, self::TEST_DB_PASSWORD, self::TEST_DB_NAME]);
106106
$this->expectException(\Exception::class);
107-
$this->expectExceptionMessageRegExp('/[does not exist]/');
107+
$this->expectExceptionMessageMatches('/[does not exist]/');
108108
$this->assertNull(column('id', 'DOS', 32));
109109
}
110110

tests/ezsqlModelTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function testSetCache_Timeout()
4343
public function testGetNotProperty()
4444
{
4545
$this->expectException(\Exception::class);
46-
$this->expectExceptionMessageRegExp('/does not exist/');
46+
$this->expectExceptionMessageMatches('/does not exist/');
4747
$res = $this->object->getNotProperty();
4848
}
4949

tests/mysqli/mysqliTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,7 @@ public function testQuery_prepared()
616616

617617
public function test__construct_Error()
618618
{
619-
$this->expectExceptionMessageRegExp('/[Missing configuration details]/');
619+
$this->expectExceptionMessageMatches('/[Missing configuration details]/');
620620
$this->assertNull(new ez_mysqli());
621621
}
622622

tests/pdo/pdo_mysqlTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -293,9 +293,9 @@ public function testJoins()
293293
$this->object->insert('unit_test', array('id' => '2', 'test_key' => 'testing 2'));
294294
$this->object->insert('unit_test', array('id' => '3', 'test_key' => 'testing 3'));
295295
$this->object->query('CREATE TABLE unit_test_child(child_id integer, child_test_key varchar(50), parent_id integer, PRIMARY KEY (child_id))');
296-
$this->object->insert('unit_test', array('child_id' => '1', 'child_test_key' => 'testing child 1', 'parent_id' => '3'));
297-
$this->object->insert('unit_test', array('child_id' => '2', 'child_test_key' => 'testing child 2', 'parent_id' => '2'));
298-
$this->object->insert('unit_test', array('child_id' => '3', 'child_test_key' => 'testing child 3', 'parent_id' => '1'));
296+
$this->object->insert('unit_test_child', array('child_id' => '1', 'child_test_key' => 'testing child 1', 'parent_id' => '3'));
297+
$this->object->insert('unit_test_child', array('child_id' => '2', 'child_test_key' => 'testing child 2', 'parent_id' => '2'));
298+
$this->object->insert('unit_test_child', array('child_id' => '3', 'child_test_key' => 'testing child 3', 'parent_id' => '1'));
299299

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

319-
$this->assertEquals(0, $this->object->query('DROP TABLE unit_test'));
320-
$this->assertEquals(0, $this->object->query('DROP TABLE unit_test_child'));
319+
$this->assertEquals(0, $this->object->drop('unit_test'));
320+
$this->assertEquals(0, $this->object->drop('unit_test_child'));
321321
}
322322

323323
public function testBeginTransactionCommit()
@@ -443,7 +443,7 @@ public function testQuery_prepared()
443443

444444
public function test__Construct_Error()
445445
{
446-
$this->expectExceptionMessageRegExp('/[Missing configuration details]/');
446+
$this->expectExceptionMessageMatches('/[Missing configuration details]/');
447447
$this->assertNull(new ez_pdo());
448448
}
449449

tests/pdo/pdo_pgsqlTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,9 @@ public function testJoins()
215215
$this->object->insert('unit_test', array('id' => '2', 'test_key' => 'testing 2'));
216216
$this->object->insert('unit_test', array('id' => '3', 'test_key' => 'testing 3'));
217217
$this->object->query('CREATE TABLE unit_test_child(child_id integer, child_test_key varchar(50), parent_id integer, PRIMARY KEY (child_id))');
218-
$this->object->insert('unit_test', array('child_id' => '1', 'child_test_key' => 'testing child 1', 'parent_id' => '3'));
219-
$this->object->insert('unit_test', array('child_id' => '2', 'child_test_key' => 'testing child 2', 'parent_id' => '2'));
220-
$this->object->insert('unit_test', array('child_id' => '3', 'child_test_key' => 'testing child 3', 'parent_id' => '1'));
218+
$this->object->insert('unit_test_child', array('child_id' => '1', 'child_test_key' => 'testing child 1', 'parent_id' => '3'));
219+
$this->object->insert('unit_test_child', array('child_id' => '2', 'child_test_key' => 'testing child 2', 'parent_id' => '2'));
220+
$this->object->insert('unit_test_child', array('child_id' => '3', 'child_test_key' => 'testing child 3', 'parent_id' => '1'));
221221

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

tests/pdo/pdo_sqliteTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,9 +244,9 @@ public function testJoins()
244244
$this->object->insert('unit_test', array('id' => '2', 'test_key' => 'testing 2'));
245245
$this->object->insert('unit_test', array('id' => '3', 'test_key' => 'testing 3'));
246246
$this->object->query('CREATE TABLE unit_test_child(child_id integer, child_test_key varchar(50), parent_id integer, PRIMARY KEY (child_id))');
247-
$this->object->insert('unit_test', array('child_id' => '1', 'child_test_key' => 'testing child 1', 'parent_id' => '3'));
248-
$this->object->insert('unit_test', array('child_id' => '2', 'child_test_key' => 'testing child 2', 'parent_id' => '2'));
249-
$this->object->insert('unit_test', array('child_id' => '3', 'child_test_key' => 'testing child 3', 'parent_id' => '1'));
247+
$this->object->insert('unit_test_child', array('child_id' => '1', 'child_test_key' => 'testing child 1', 'parent_id' => '3'));
248+
$this->object->insert('unit_test_child', array('child_id' => '2', 'child_test_key' => 'testing child 2', 'parent_id' => '2'));
249+
$this->object->insert('unit_test_child', array('child_id' => '3', 'child_test_key' => 'testing child 3', 'parent_id' => '1'));
250250

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

tests/pdo/pdo_sqlsrvTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,9 +219,9 @@ public function testJoins()
219219
$this->object->insert('unit_test', array('id' => '2', 'test_key' => 'testing 2'));
220220
$this->object->insert('unit_test', array('id' => '3', 'test_key' => 'testing 3'));
221221
$this->object->query('CREATE TABLE unit_test_child(child_id integer, child_test_key varchar(50), parent_id integer, PRIMARY KEY (child_id))');
222-
$this->object->insert('unit_test', array('child_id' => '1', 'child_test_key' => 'testing child 1', 'parent_id' => '3'));
223-
$this->object->insert('unit_test', array('child_id' => '2', 'child_test_key' => 'testing child 2', 'parent_id' => '2'));
224-
$this->object->insert('unit_test', array('child_id' => '3', 'child_test_key' => 'testing child 3', 'parent_id' => '1'));
222+
$this->object->insert('unit_test_child', array('child_id' => '1', 'child_test_key' => 'testing child 1', 'parent_id' => '3'));
223+
$this->object->insert('unit_test_child', array('child_id' => '2', 'child_test_key' => 'testing child 2', 'parent_id' => '2'));
224+
$this->object->insert('unit_test_child', array('child_id' => '3', 'child_test_key' => 'testing child 3', 'parent_id' => '1'));
225225

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

0 commit comments

Comments
 (0)