Skip to content

Commit 434bc66

Browse files
committed
Upgrading PHPunit to v8.
Removing nette/bootstrap explicit dependency (was needed due to a temporary bug)
1 parent 0333890 commit 434bc66

File tree

5 files changed

+29
-34
lines changed

5 files changed

+29
-34
lines changed

composer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@
4949
"thecodingmachine/tdbm-fluid-schema-builder": "^1.0.0",
5050
"phpstan/phpstan": "^0.11.5",
5151
"thecodingmachine/phpstan-strict-rules": "^0.11.0",
52-
"bamarni/composer-bin-plugin": "^1.2",
53-
"nette/bootstrap": "^2.4.6"
52+
"bamarni/composer-bin-plugin": "^1.2"
5453
},
5554
"conflict": {
5655
"mouf/database.tdbm": "~5.0.0"

tests/Commands/GenerateCommandTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function testCall(): void
2626

2727
$result = $this->callCommand(new GenerateCommand($this->getConfiguration()), $input);
2828

29-
$this->assertContains('Finished regenerating DAOs and beans', $result);
29+
$this->assertStringContainsString('Finished regenerating DAOs and beans', $result);
3030
}
3131

3232
/**

tests/MapIteratorTest.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,17 @@
2525

2626
class MapIteratorTest extends TestCase
2727
{
28-
/**
29-
* @expectedException \TheCodingMachine\TDBM\TDBMException
30-
*/
3128
public function testConstructorException1(): void
3229
{
30+
$this->expectException('TheCodingMachine\TDBM\TDBMException');
3331
$mapIterator = new MapIterator(new \DateTime(), function ($item) {
3432
return $item;
3533
});
3634
}
3735

38-
/**
39-
* @expectedException \TheCodingMachine\TDBM\TDBMException
40-
*/
4136
public function testConstructorException2(): void
4237
{
38+
$this->expectException('TheCodingMachine\TDBM\TDBMException');
4339
$mapIterator = new MapIterator(array(1, 2, 3), function () {
4440
return $item;
4541
});

tests/TDBMDaoGeneratorTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -781,14 +781,14 @@ public function testFindFilters(): void
781781
}
782782

783783
/**
784-
* @expectedException \TheCodingMachine\TDBM\TDBMException
785784
* @depends testDaoGeneration
786785
*/
787786
public function testFindMode(): void
788787
{
789788
$userDao = new TestUserDao($this->tdbmService);
790789
$users = $userDao->getUsersByLoginStartingWith('bill', TDBMService::MODE_CURSOR);
791790

791+
$this->expectException('TheCodingMachine\TDBM\TDBMException');
792792
$users[0];
793793
}
794794

@@ -878,13 +878,13 @@ public function testSetToNullForeignKey(): void
878878

879879
/**
880880
* @depends testDaoGeneration
881-
* @expectedException \Mouf\Database\SchemaAnalyzer\SchemaAnalyzerTableNotFoundException
882-
* @expectedExceptionMessage Could not find table 'contacts'. Did you mean 'contact'?
883881
*/
884882
public function testQueryOnWrongTableName(): void
885883
{
886884
$userDao = new TestUserDao($this->tdbmService);
887885
$users = $userDao->getUsersWrongTableName();
886+
$this->expectException('Mouf\Database\SchemaAnalyzer\SchemaAnalyzerTableNotFoundException');
887+
$this->expectExceptionMessage('Could not find table \'contacts\'. Did you mean \'contact\'?');
888888
$users->count();
889889
}
890890

@@ -1081,17 +1081,16 @@ public function testDiscardChanges(): void
10811081
}
10821082

10831083
/**
1084-
* @expectedException \TheCodingMachine\TDBM\TDBMException
10851084
* @depends testDaoGeneration
10861085
*/
10871086
public function testDiscardChangesOnNewBeanFails(): void
10881087
{
10891088
$person = new PersonBean('John Foo', new \DateTimeImmutable());
1089+
$this->expectException('TheCodingMachine\TDBM\TDBMException');
10901090
$person->discardChanges();
10911091
}
10921092

10931093
/**
1094-
* @expectedException \TheCodingMachine\TDBM\TDBMException
10951094
* @depends testDaoGeneration
10961095
*/
10971096
public function testDiscardChangesOnDeletedBeanFails(): void
@@ -1105,6 +1104,7 @@ public function testDiscardChangesOnDeletedBeanFails(): void
11051104

11061105
$userDao->delete($sanchez);
11071106

1107+
$this->expectException('TheCodingMachine\TDBM\TDBMException');
11081108
// Cannot discard changes on a bean that is already deleted.
11091109
$sanchez->discardChanges();
11101110
}
@@ -1688,7 +1688,7 @@ public function testBlob(): void
16881688
$resource = $loadedFile->getFile();
16891689
$result = fseek($resource, 0);
16901690
$this->assertSame(0, $result);
1691-
$this->assertInternalType('resource', $resource);
1691+
$this->assertIsResource($resource);
16921692
$firstLine = fgets($resource);
16931693
$this->assertSame("<?php\n", $firstLine);
16941694
}
@@ -1702,7 +1702,7 @@ public function testReadBlob(): void
17021702
$loadedFile = $fileDao->getById(1);
17031703

17041704
$resource = $loadedFile->getFile();
1705-
$this->assertInternalType('resource', $resource);
1705+
$this->assertIsResource($resource);
17061706
$firstLine = fgets($resource);
17071707
$this->assertSame("<?php\n", $firstLine);
17081708

tests/TDBMServiceTest.php

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -47,22 +47,22 @@ public function testGetRelatedTablesByInheritance(): void
4747
}
4848

4949
/**
50-
* @expectedException \TheCodingMachine\TDBM\TDBMException
5150
*
5251
* @throws TDBMException
5352
*/
5453
public function testGetPrimaryKeysFromIndexedPrimaryKeysException(): void
5554
{
55+
$this->expectException('TheCodingMachine\TDBM\TDBMException');
5656
$this->tdbmService->_getPrimaryKeysFromIndexedPrimaryKeys('users', [5, 4]);
5757
}
5858

5959
/**
60-
* @expectedException \TheCodingMachine\TDBM\TDBMException
6160
*
6261
* @throws TDBMException
6362
*/
6463
public function testGetLinkBetweenInheritedTablesExceptions(): void
6564
{
65+
$this->expectException('TheCodingMachine\TDBM\TDBMException');
6666
$this->tdbmService->_getLinkBetweenInheritedTables(['contact', 'country']);
6767
}
6868

@@ -156,12 +156,12 @@ public function testUpdatePrimaryKey(): void
156156
}
157157

158158
/**
159-
* @expectedException \TheCodingMachine\TDBM\TDBMInvalidOperationException
160159
*
161160
* @throws TDBMInvalidOperationException
162161
*/
163162
public function testCannotDeleteDetachedObjects(): void
164163
{
164+
$this->expectException('TheCodingMachine\TDBM\TDBMInvalidOperationException');
165165
$object = new TDBMObject('rights');
166166
$object->setProperty('label', 'CAN_DELETE');
167167

@@ -338,36 +338,36 @@ public function testArrayAccess(): void
338338
}
339339

340340
/**
341-
* @expectedException \TheCodingMachine\TDBM\TDBMInvalidOffsetException
342341
*
343342
* @throws TDBMInvalidOffsetException
344343
*/
345344
public function testArrayAccessException(): void
346345
{
346+
$this->expectException('TheCodingMachine\TDBM\TDBMInvalidOffsetException');
347347
$beans = $this->tdbmService->findObjects('contact', null, [], 'contact.id ASC', [], null, TDBMObject::class);
348348

349349
$beans[-1];
350350
}
351351

352352
/**
353-
* @expectedException \TheCodingMachine\TDBM\TDBMInvalidOffsetException
354353
*
355354
* @throws TDBMInvalidOffsetException
356355
*/
357356
public function testArrayAccessException2(): void
358357
{
358+
$this->expectException('TheCodingMachine\TDBM\TDBMInvalidOffsetException');
359359
$beans = $this->tdbmService->findObjects('contact', null, [], 'contact.id ASC', [], null, TDBMObject::class);
360360

361361
$beans['foo'];
362362
}
363363

364364
/**
365-
* @expectedException \TheCodingMachine\TDBM\TDBMException
366365
*
367366
* @throws TDBMException
368367
*/
369368
public function testBeanGetException(): void
370369
{
370+
$this->expectException('TheCodingMachine\TDBM\TDBMException');
371371
$beans = $this->tdbmService->findObjects('contact', null, [], 'contact.id ASC', [], null, TDBMObject::class);
372372
$bean = $beans[0];
373373

@@ -376,12 +376,12 @@ public function testBeanGetException(): void
376376
}
377377

378378
/**
379-
* @expectedException \TheCodingMachine\TDBM\TDBMException
380379
*
381380
* @throws TDBMException
382381
*/
383382
public function testBeanSetException(): void
384383
{
384+
$this->expectException('TheCodingMachine\TDBM\TDBMException');
385385
$beans = $this->tdbmService->findObjects('contact', null, [], 'contact.id ASC', [], null, TDBMObject::class);
386386
$bean = $beans[0];
387387

@@ -464,48 +464,48 @@ public function testMap(): void
464464
}
465465

466466
/**
467-
* @expectedException \TheCodingMachine\TDBM\TDBMException
468467
*
469468
* @throws TDBMException
470469
*/
471470
public function testUnsetException(): void
472471
{
472+
$this->expectException('TheCodingMachine\TDBM\TDBMException');
473473
$beans = $this->tdbmService->findObjects('contact', null, [], 'contact.id ASC', [], null, TDBMObject::class);
474474

475475
unset($beans[0]);
476476
}
477477

478478
/**
479-
* @expectedException \TheCodingMachine\TDBM\TDBMException
480479
*
481480
* @throws TDBMException
482481
*/
483482
public function testSetException(): void
484483
{
484+
$this->expectException('TheCodingMachine\TDBM\TDBMException');
485485
$beans = $this->tdbmService->findObjects('contact', null, [], 'contact.id ASC', [], null, TDBMObject::class);
486486

487487
$beans[0] = 'foo';
488488
}
489489

490490
/**
491-
* @expectedException \TheCodingMachine\TDBM\TDBMException
492491
*
493492
* @throws TDBMException
494493
*/
495494
public function testPageUnsetException(): void
496495
{
496+
$this->expectException('TheCodingMachine\TDBM\TDBMException');
497497
$beans = $this->tdbmService->findObjects('contact', null, [], 'contact.id ASC', [], null, TDBMObject::class);
498498
$page = $beans->take(0, 1);
499499
unset($page[0]);
500500
}
501501

502502
/**
503-
* @expectedException \TheCodingMachine\TDBM\TDBMException
504503
*
505504
* @throws TDBMException
506505
*/
507506
public function testPageSetException(): void
508507
{
508+
$this->expectException('TheCodingMachine\TDBM\TDBMException');
509509
$beans = $this->tdbmService->findObjects('contact', null, [], 'contact.id ASC', [], null, TDBMObject::class);
510510
$page = $beans->take(0, 1);
511511
$page[0] = 'foo';
@@ -570,32 +570,32 @@ public function testSetFetchMode(): void
570570
}
571571

572572
/**
573-
* @expectedException \TheCodingMachine\TDBM\TDBMException
574573
*
575574
* @throws TDBMException
576575
*/
577576
public function testInvalidSetFetchMode(): void
578577
{
578+
$this->expectException('TheCodingMachine\TDBM\TDBMException');
579579
$this->tdbmService->setFetchMode(99);
580580
}
581581

582582
/**
583-
* @expectedException \TheCodingMachine\TDBM\TDBMException
584583
*
585584
* @throws TDBMException
586585
*/
587586
public function testCursorModeException(): void
588587
{
588+
$this->expectException('TheCodingMachine\TDBM\TDBMException');
589589
$beans = $this->tdbmService->findObjects('contact', 'contact.id = :id', ['id' => 1], null, [], 99);
590590
}
591591

592592
/**
593-
* @expectedException \TheCodingMachine\TDBM\TDBMException
594593
*
595594
* @throws TDBMException
596595
*/
597596
public function testTableNameException(): void
598597
{
598+
$this->expectException('TheCodingMachine\TDBM\TDBMException');
599599
$beans = $this->tdbmService->findObjects('foo bar');
600600
}
601601

@@ -612,12 +612,12 @@ public function testFindObject(): void
612612
}
613613

614614
/**
615-
* @expectedException \TheCodingMachine\TDBM\NoBeanFoundException
616615
*
617616
* @throws NoBeanFoundException
618617
*/
619618
public function testFindObjectOrFail(): void
620619
{
620+
$this->expectException('TheCodingMachine\TDBM\NoBeanFoundException');
621621
$bean = $this->tdbmService->findObjectOrFail('contact', 'contact.id = :id', ['id' => -42], [], TDBMObject::class);
622622
}
623623

@@ -651,13 +651,13 @@ public function testFindObjectsByBean(): void
651651
}
652652

653653
/**
654-
* @expectedException \TheCodingMachine\TDBM\TDBMException
655654
*
656655
* @throws TDBMException
657656
* @throws TDBMInvalidOperationException
658657
*/
659658
public function testBeanWithoutStatus(): void
660659
{
660+
$this->expectException('TheCodingMachine\TDBM\TDBMException');
661661
$reflectionClass = new \ReflectionClass(TDBMObject::class);
662662
$object = $reflectionClass->newInstanceWithoutConstructor();
663663
$object->_getStatus();
@@ -677,12 +677,12 @@ public function testFindObjectsFromSql(): void
677677
}
678678

679679
/**
680-
* @expectedException \TheCodingMachine\TDBM\TDBMException
681680
*
682681
* @throws TDBMException
683682
*/
684683
public function testFindObjectsFromSqlBadTableName(): void
685684
{
685+
$this->expectException('TheCodingMachine\TDBM\TDBMException');
686686
$this->tdbmService->findObjectsFromSql(
687687
'#{azerty',
688688
'roles JOIN roles_rights ON roles.id = roles_rights.role_id JOIN rights ON rights.label = roles_rights.right_label',
@@ -693,12 +693,12 @@ public function testFindObjectsFromSqlBadTableName(): void
693693
}
694694

695695
/**
696-
* @expectedException \TheCodingMachine\TDBM\TDBMException
697696
*
698697
* @throws TDBMException
699698
*/
700699
public function testFindObjectsFromSqlGroupBy(): void
701700
{
701+
$this->expectException('TheCodingMachine\TDBM\TDBMException');
702702
$roles = $this->tdbmService->findObjectsFromSql(
703703
'roles',
704704
'roles JOIN roles_rights ON roles.id = roles_rights.role_id JOIN rights ON rights.label = roles_rights.right_label',

0 commit comments

Comments
 (0)