Skip to content

Commit e7146cd

Browse files
committed
Update versions
1 parent 7dc2469 commit e7146cd

8 files changed

Lines changed: 59 additions & 109 deletions

File tree

composer.json

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,22 @@
1212
}
1313
],
1414
"require": {
15-
"php": ">=5.4.0",
15+
"php": "~8",
1616
"ext-json":"*",
17-
"regex-guard/regex-guard": "~1.0",
18-
"nikic/php-parser" : ">=2.0 <5.0.0"
17+
"regex-guard/regex-guard": "~1.1",
18+
"nikic/php-parser" : ">=4.0 <5.0.0"
1919
},
2020
"require-dev": {
21-
"mockery/mockery": "^0.9",
22-
"phpunit/phpunit": ">=4.8 <6.0.0"
21+
"mockery/mockery": "~1.6",
22+
"phpunit/phpunit": "~10"
2323
},
2424
"autoload": {
2525
"psr-4": { "Minime\\Annotations\\": "src/" }
2626
},
2727
"autoload-dev": {
2828
"psr-4": { "Minime\\Annotations\\Fixtures\\": "test/fixtures/" }
29+
},
30+
"scripts": {
31+
"test": "phpunit"
2932
}
3033
}

phpunit.xml.dist

Lines changed: 4 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2,50 +2,18 @@
22

33
<phpunit bootstrap="vendor/autoload.php"
44
backupGlobals="false"
5-
backupStaticAttributes="false"
5+
backupStaticProperties="false"
66
colors="true"
7-
verbose="true"
8-
convertErrorsToExceptions="true"
9-
convertNoticesToExceptions="true"
10-
convertWarningsToExceptions="true"
117
processIsolation="false"
128
stopOnFailure="false">
13-
9+
1410
<testsuites>
15-
<testsuite>
11+
<testsuite name="unit">
1612
<directory>test/suite/</directory>
1713
</testsuite>
1814
</testsuites>
1915

20-
<filter>
21-
<whitelist processUncoveredFilesFromWhitelist="true">
22-
<directory>src/</directory>
23-
</whitelist>
24-
</filter>
25-
2616
<logging>
27-
<log
28-
type="tap"
29-
target="build/logs/report.tap"
30-
/>
31-
<log
32-
type="junit"
33-
target="build/logs/report.junit.xml"
34-
/>
35-
<log
36-
type="coverage-html"
37-
target="build/logs/coverage"
38-
charset="UTF-8"
39-
yui="true"
40-
highlight="true"
41-
/>
42-
<log
43-
type="coverage-text"
44-
target="build/logs/coverage.txt"
45-
/>
46-
<log
47-
type="coverage-clover"
48-
target="build/logs/clover.xml"
49-
/>
17+
<junit outputFile="build/logs/report.junit.xml"/>
5018
</logging>
5119
</phpunit>

test/suite/AnnotationsBagTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
/**
88
* @group bag
99
*/
10-
class AnnotationsBagTest extends \PHPUnit_Framework_TestCase
10+
class AnnotationsBagTest extends \PHPUnit\Framework\TestCase
1111
{
1212

1313
private $Bag;
1414

15-
public function setUp()
15+
protected function setUp(): void
1616
{
1717
$this->Bag = new AnnotationsBag(
1818
[

test/suite/BaseTest.php

Lines changed: 0 additions & 38 deletions
This file was deleted.

test/suite/CacheTest.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010
use Minime\Annotations\Cache\ApcCache;
1111
use Minime\Annotations\Fixtures\AnnotationsFixture;
1212

13-
class CacheTest extends \PHPUnit_Framework_TestCase
13+
class CacheTest extends \PHPUnit\Framework\TestCase
1414
{
1515

1616
protected $fixtureClass = 'Minime\Annotations\Fixtures\AnnotationsFixture';
1717

18-
public function tearDown()
18+
protected function tearDown(): void
1919
{
2020
Mockery::close();
2121
}
@@ -54,14 +54,13 @@ public function testFileCache(){
5454
}
5555

5656
public function testFileCacheWithDefaultStoragePath(){
57-
new FileCache();
57+
$this->assertCacheHandlerWorks(new FileCache());
5858
}
5959

60-
/**
61-
* @expectedException \InvalidArgumentException
62-
* @expectedExceptionMessageRegExp #^Cache path is not a writable/readable directory: .+\.#
63-
*/
6460
public function testFileCacheWithBadStoragePath(){
61+
$this->expectException('InvalidArgumentException');
62+
$this->expectExceptionMessage('Cache path is not a writable/readable directory:');
63+
6564
new FileCache(__DIR__ . '/invalid/path/');
6665
}
6766

test/suite/DynamicParserTest.php

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,39 @@
22

33
namespace Minime\Annotations;
44

5+
use \ReflectionProperty;
6+
use Minime\Annotations\Fixtures\AnnotationsFixture;
7+
use Minime\Annotations\Interfaces\ParserInterface;
8+
59
/**
610
* DynamicParserTest
7-
*
11+
*
812
* @group parser
913
*/
10-
class DynamicParserTest extends BaseTest
14+
class DynamicParserTest extends \PHPUnit\Framework\TestCase
1115
{
12-
public function setUp()
16+
protected $fixture;
17+
18+
/**
19+
* @var ParserInterface
20+
*/
21+
protected $parser;
22+
23+
protected function getDocblock($fixture)
24+
{
25+
$reflection = new ReflectionProperty($this->fixture, $fixture);
26+
27+
return $reflection->getDocComment();
28+
}
29+
30+
protected function getFixture($fixture)
31+
{
32+
return $this->parser->parse($this->getDocblock($fixture));
33+
}
34+
35+
protected function setUp(): void
1336
{
14-
parent::setup();
37+
$this->fixture = new AnnotationsFixture;
1538
$this->parser = new DynamicParser;
1639
}
1740

test/suite/ParserTest.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*/
1010
class ParserTest extends DynamicParserTest
1111
{
12-
public function setUp()
12+
protected function setUp(): void
1313
{
1414
parent::setup();
1515
$this->parser = new Parser;
@@ -73,15 +73,16 @@ public function parseConcreteFixture()
7373

7474
/**
7575
* @test
76-
* @expectedException \Minime\Annotations\ParserException
7776
* @dataProvider invalidConcreteAnnotationFixtureProvider
7877
*/
7978
public function parseInvalidConcreteFixture($fixture)
8079
{
80+
$this->expectException(ParserException::class);
81+
8182
$this->getFixture($fixture);
8283
}
8384

84-
public function invalidConcreteAnnotationFixtureProvider()
85+
public static function invalidConcreteAnnotationFixtureProvider()
8586
{
8687
return [
8788
['bad_concrete_fixture'],
@@ -140,28 +141,31 @@ public function tolerateUnrecognizedTypes()
140141

141142
/**
142143
* @test
143-
* @expectedException \Minime\Annotations\ParserException
144144
*/
145145
public function exceptionWithBadJsonValue()
146146
{
147+
$this->expectException(ParserException::class);
148+
147149
$this->getFixture('bad_json_fixture');
148150
}
149151

150152
/**
151153
* @test
152-
* @expectedException \Minime\Annotations\ParserException
153154
*/
154155
public function exceptionWithBadIntegerValue()
155156
{
157+
$this->expectException(ParserException::class);
158+
156159
$this->getFixture('bad_integer_fixture');
157160
}
158161

159162
/**
160163
* @test
161-
* @expectedException \Minime\Annotations\ParserException
162164
*/
163165
public function exceptionWithBadFloatValue()
164166
{
167+
$this->expectException(ParserException::class);
168+
165169
$this->getFixture('bad_float_fixture');
166170
}
167171

test/suite/ReaderTest.php

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33

44
use Minime\Annotations\Fixtures\AnnotationsFixture;
55

6-
class ReaderTest extends \PHPUnit_Framework_TestCase
6+
class ReaderTest extends \PHPUnit\Framework\TestCase
77
{
88
private $fixture;
99

10-
public function setUp()
10+
protected function setUp(): void
1111
{
1212
$this->fixture = new AnnotationsFixture;
1313
}
@@ -32,15 +32,6 @@ public function testGetAnnotations()
3232
$this->assertTrue($annotations->get('get'));
3333
}
3434

35-
public function testReadFunctionAnnotations()
36-
{
37-
if(! function_exists($fn = __NAMESPACE__ . '\\fn')){
38-
/** @bar */ function fn(){}
39-
}
40-
41-
$this->assertTrue($this->getReader()->getFunctionAnnotations($fn)->get('bar'));
42-
}
43-
4435
public function testReadClosureAnnotations()
4536
{
4637
/** @foo */

0 commit comments

Comments
 (0)