Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Commit fc5da6e

Browse files
authored
Merge pull request #115 from webimpress/fix/assert
Changed all assertions to self::assert instead of $this->...
2 parents ef89962 + 28e6495 commit fc5da6e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+945
-945
lines changed

test/Annotation/AnnotationManagerTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,17 @@ public function testAllowsMultipleParsingStrategies()
4040
$prop = $reflection->getProperty('test');
4141
$annotations = $prop->getAnnotations($this->manager);
4242

43-
$this->assertTrue($annotations->hasAnnotation(TestAsset\Foo::class));
44-
$this->assertTrue($annotations->hasAnnotation(TestAsset\DoctrineAnnotation::class));
45-
$this->assertFalse($annotations->hasAnnotation(TestAsset\Bar::class));
43+
self::assertTrue($annotations->hasAnnotation(TestAsset\Foo::class));
44+
self::assertTrue($annotations->hasAnnotation(TestAsset\DoctrineAnnotation::class));
45+
self::assertFalse($annotations->hasAnnotation(TestAsset\Bar::class));
4646

4747
foreach ($annotations as $annotation) {
4848
switch (get_class($annotation)) {
4949
case TestAsset\Foo::class:
50-
$this->assertEquals('first', $annotation->content);
50+
self::assertEquals('first', $annotation->content);
5151
break;
5252
case TestAsset\DoctrineAnnotation::class:
53-
$this->assertEquals(['foo' => 'bar', 'bar' => 'baz'], $annotation->value);
53+
self::assertEquals(['foo' => 'bar', 'bar' => 'baz'], $annotation->value);
5454
break;
5555
default:
5656
$this->fail('Received unexpected annotation "' . get_class($annotation) . '"');

test/Annotation/DoctrineAnnotationParserTest.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,19 +49,19 @@ public function testParserCreatesNewAnnotationInstances()
4949

5050
$event = $this->getEvent();
5151
$test = $this->parser->onCreateAnnotation($event);
52-
$this->assertInstanceOf(__NAMESPACE__ . '\TestAsset\DoctrineAnnotation', $test);
53-
$this->assertEquals(['foo' => 'bar'], $test->value);
52+
self::assertInstanceOf(__NAMESPACE__ . '\TestAsset\DoctrineAnnotation', $test);
53+
self::assertEquals(['foo' => 'bar'], $test->value);
5454
}
5555

5656
public function testReturnsFalseDuringCreationIfAnnotationIsNotRegistered()
5757
{
5858
$event = $this->getEvent();
59-
$this->assertFalse($this->parser->onCreateAnnotation($event));
59+
self::assertFalse($this->parser->onCreateAnnotation($event));
6060
}
6161

6262
public function testReturnsFalseClassNotSet()
6363
{
64-
$this->assertFalse($this->parser->onCreateAnnotation(new Event()));
64+
self::assertFalse($this->parser->onCreateAnnotation(new Event()));
6565
}
6666

6767
public function testReturnsFalseRawNotSet()
@@ -70,15 +70,15 @@ public function testReturnsFalseRawNotSet()
7070
$event = $this->getEvent();
7171
$event->setParam('raw', false);
7272

73-
$this->assertFalse($this->parser->onCreateAnnotation($event));
73+
self::assertFalse($this->parser->onCreateAnnotation($event));
7474
}
7575

7676
public function testReturnsFalseEmptyAnnotations()
7777
{
7878
$this->parser->registerAnnotation(__NAMESPACE__ . '\TestAsset\DoctrineAnnotation');
7979
$event = $this->getEvent();
8080
$event->setParam('raw', 'foo');
81-
$this->assertFalse($this->parser->onCreateAnnotation($event));
81+
self::assertFalse($this->parser->onCreateAnnotation($event));
8282
}
8383

8484
public function testRegisterAnnotationsThrowsException()
@@ -92,7 +92,7 @@ public function testRegisterAnnotations()
9292
$this->parser->registerAnnotations([__NAMESPACE__ . '\TestAsset\DoctrineAnnotation']);
9393
$event = $this->getEvent();
9494
$test = $this->parser->onCreateAnnotation($event);
95-
$this->assertInstanceOf(__NAMESPACE__ . '\TestAsset\DoctrineAnnotation', $test);
96-
$this->assertEquals(['foo' => 'bar'], $test->value);
95+
self::assertInstanceOf(__NAMESPACE__ . '\TestAsset\DoctrineAnnotation', $test);
96+
self::assertEquals(['foo' => 'bar'], $test->value);
9797
}
9898
}

test/Annotation/GenericAnnotationParserTest.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ public function testParserKeepsTrackOfAllowedAnnotations()
4242
$this->parser->registerAnnotation(new TestAsset\Foo());
4343
$this->parser->registerAnnotation(new TestAsset\Bar());
4444

45-
$this->assertTrue($this->parser->hasAnnotation(__NAMESPACE__ . '\TestAsset\Foo'));
46-
$this->assertTrue($this->parser->hasAnnotation(__NAMESPACE__ . '\TestAsset\Bar'));
47-
$this->assertFalse($this->parser->hasAnnotation(__NAMESPACE__ . '\TestAsset\Bogus'));
45+
self::assertTrue($this->parser->hasAnnotation(__NAMESPACE__ . '\TestAsset\Foo'));
46+
self::assertTrue($this->parser->hasAnnotation(__NAMESPACE__ . '\TestAsset\Bar'));
47+
self::assertFalse($this->parser->hasAnnotation(__NAMESPACE__ . '\TestAsset\Bogus'));
4848
}
4949

5050
public function testParserCreatesNewAnnotationInstances()
@@ -54,15 +54,15 @@ public function testParserCreatesNewAnnotationInstances()
5454

5555
$event = $this->getFooEvent();
5656
$test = $this->parser->onCreateAnnotation($event);
57-
$this->assertInstanceOf(__NAMESPACE__ . '\TestAsset\Foo', $test);
58-
$this->assertNotSame($foo, $test);
59-
$this->assertEquals('test content', $test->content);
57+
self::assertInstanceOf(__NAMESPACE__ . '\TestAsset\Foo', $test);
58+
self::assertNotSame($foo, $test);
59+
self::assertEquals('test content', $test->content);
6060
}
6161

6262
public function testReturnsFalseDuringCreationIfAnnotationIsNotRegistered()
6363
{
6464
$event = $this->getFooEvent();
65-
$this->assertFalse($this->parser->onCreateAnnotation($event));
65+
self::assertFalse($this->parser->onCreateAnnotation($event));
6666
}
6767

6868
public function testParserAllowsPassingArrayOfAnnotationInstances()
@@ -71,8 +71,8 @@ public function testParserAllowsPassingArrayOfAnnotationInstances()
7171
new TestAsset\Foo(),
7272
new TestAsset\Bar(),
7373
]);
74-
$this->assertTrue($this->parser->hasAnnotation(__NAMESPACE__ . '\TestAsset\Foo'));
75-
$this->assertTrue($this->parser->hasAnnotation(__NAMESPACE__ . '\TestAsset\Bar'));
74+
self::assertTrue($this->parser->hasAnnotation(__NAMESPACE__ . '\TestAsset\Foo'));
75+
self::assertTrue($this->parser->hasAnnotation(__NAMESPACE__ . '\TestAsset\Bar'));
7676
}
7777

7878
public function testAllowsSpecifyingAliases()
@@ -83,9 +83,9 @@ public function testAllowsSpecifyingAliases()
8383

8484
$event = $this->getFooEvent();
8585
$test = $this->parser->onCreateAnnotation($event);
86-
$this->assertInstanceOf(__NAMESPACE__ . '\TestAsset\Bar', $test);
87-
$this->assertNotSame($bar, $test);
88-
$this->assertEquals('test content', $test->content);
86+
self::assertInstanceOf(__NAMESPACE__ . '\TestAsset\Bar', $test);
87+
self::assertNotSame($bar, $test);
88+
self::assertEquals('test content', $test->content);
8989
}
9090

9191
public function testRegisterAnnotationAllowsAnnotationInterfaceOnly()
@@ -108,7 +108,7 @@ public function testRegisterAnnotations()
108108
$this->parser->registerAnnotations([new TestAsset\Foo]);
109109
$event = $this->getFooEvent();
110110
$test = $this->parser->onCreateAnnotation($event);
111-
$this->assertInstanceOf(__NAMESPACE__ . '\TestAsset\Foo', $test);
111+
self::assertInstanceOf(__NAMESPACE__ . '\TestAsset\Foo', $test);
112112
}
113113

114114
public function testRegisterAnnotationsThrowsException()

test/Generator/AbstractGeneratorTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ public function testConstructor()
2828
],
2929
]);
3030

31-
$this->assertInstanceOf(GeneratorInterface::class, $generator);
32-
$this->assertEquals('foo', $generator->getIndentation());
31+
self::assertInstanceOf(GeneratorInterface::class, $generator);
32+
self::assertEquals('foo', $generator->getIndentation());
3333
}
3434

3535
public function testSetOptionsThrowsExceptionOnInvalidArgument()

test/Generator/AbstractMemberGeneratorTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ public function testSetFlagsWithArray()
3434
]
3535
);
3636

37-
$this->assertEquals(AbstractMemberGenerator::VISIBILITY_PUBLIC, $this->fixture->getVisibility());
38-
$this->assertEquals(true, $this->fixture->isFinal());
37+
self::assertEquals(AbstractMemberGenerator::VISIBILITY_PUBLIC, $this->fixture->getVisibility());
38+
self::assertEquals(true, $this->fixture->isFinal());
3939
}
4040

4141
public function testSetDocBlockThrowsExceptionWithInvalidType()

0 commit comments

Comments
 (0)