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

Changed all assertions to self::assert instead of $this->... #115

Merged
merged 1 commit into from
Jul 3, 2017
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
10 changes: 5 additions & 5 deletions test/Annotation/AnnotationManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,17 @@ public function testAllowsMultipleParsingStrategies()
$prop = $reflection->getProperty('test');
$annotations = $prop->getAnnotations($this->manager);

$this->assertTrue($annotations->hasAnnotation(TestAsset\Foo::class));
$this->assertTrue($annotations->hasAnnotation(TestAsset\DoctrineAnnotation::class));
$this->assertFalse($annotations->hasAnnotation(TestAsset\Bar::class));
self::assertTrue($annotations->hasAnnotation(TestAsset\Foo::class));
self::assertTrue($annotations->hasAnnotation(TestAsset\DoctrineAnnotation::class));
self::assertFalse($annotations->hasAnnotation(TestAsset\Bar::class));

foreach ($annotations as $annotation) {
switch (get_class($annotation)) {
case TestAsset\Foo::class:
$this->assertEquals('first', $annotation->content);
self::assertEquals('first', $annotation->content);
break;
case TestAsset\DoctrineAnnotation::class:
$this->assertEquals(['foo' => 'bar', 'bar' => 'baz'], $annotation->value);
self::assertEquals(['foo' => 'bar', 'bar' => 'baz'], $annotation->value);
break;
default:
$this->fail('Received unexpected annotation "' . get_class($annotation) . '"');
Expand Down
16 changes: 8 additions & 8 deletions test/Annotation/DoctrineAnnotationParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,19 @@ public function testParserCreatesNewAnnotationInstances()

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

public function testReturnsFalseDuringCreationIfAnnotationIsNotRegistered()
{
$event = $this->getEvent();
$this->assertFalse($this->parser->onCreateAnnotation($event));
self::assertFalse($this->parser->onCreateAnnotation($event));
}

public function testReturnsFalseClassNotSet()
{
$this->assertFalse($this->parser->onCreateAnnotation(new Event()));
self::assertFalse($this->parser->onCreateAnnotation(new Event()));
}

public function testReturnsFalseRawNotSet()
Expand All @@ -70,15 +70,15 @@ public function testReturnsFalseRawNotSet()
$event = $this->getEvent();
$event->setParam('raw', false);

$this->assertFalse($this->parser->onCreateAnnotation($event));
self::assertFalse($this->parser->onCreateAnnotation($event));
}

public function testReturnsFalseEmptyAnnotations()
{
$this->parser->registerAnnotation(__NAMESPACE__ . '\TestAsset\DoctrineAnnotation');
$event = $this->getEvent();
$event->setParam('raw', 'foo');
$this->assertFalse($this->parser->onCreateAnnotation($event));
self::assertFalse($this->parser->onCreateAnnotation($event));
}

public function testRegisterAnnotationsThrowsException()
Expand All @@ -92,7 +92,7 @@ public function testRegisterAnnotations()
$this->parser->registerAnnotations([__NAMESPACE__ . '\TestAsset\DoctrineAnnotation']);
$event = $this->getEvent();
$test = $this->parser->onCreateAnnotation($event);
$this->assertInstanceOf(__NAMESPACE__ . '\TestAsset\DoctrineAnnotation', $test);
$this->assertEquals(['foo' => 'bar'], $test->value);
self::assertInstanceOf(__NAMESPACE__ . '\TestAsset\DoctrineAnnotation', $test);
self::assertEquals(['foo' => 'bar'], $test->value);
}
}
26 changes: 13 additions & 13 deletions test/Annotation/GenericAnnotationParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ public function testParserKeepsTrackOfAllowedAnnotations()
$this->parser->registerAnnotation(new TestAsset\Foo());
$this->parser->registerAnnotation(new TestAsset\Bar());

$this->assertTrue($this->parser->hasAnnotation(__NAMESPACE__ . '\TestAsset\Foo'));
$this->assertTrue($this->parser->hasAnnotation(__NAMESPACE__ . '\TestAsset\Bar'));
$this->assertFalse($this->parser->hasAnnotation(__NAMESPACE__ . '\TestAsset\Bogus'));
self::assertTrue($this->parser->hasAnnotation(__NAMESPACE__ . '\TestAsset\Foo'));
self::assertTrue($this->parser->hasAnnotation(__NAMESPACE__ . '\TestAsset\Bar'));
self::assertFalse($this->parser->hasAnnotation(__NAMESPACE__ . '\TestAsset\Bogus'));
}

public function testParserCreatesNewAnnotationInstances()
Expand All @@ -54,15 +54,15 @@ public function testParserCreatesNewAnnotationInstances()

$event = $this->getFooEvent();
$test = $this->parser->onCreateAnnotation($event);
$this->assertInstanceOf(__NAMESPACE__ . '\TestAsset\Foo', $test);
$this->assertNotSame($foo, $test);
$this->assertEquals('test content', $test->content);
self::assertInstanceOf(__NAMESPACE__ . '\TestAsset\Foo', $test);
self::assertNotSame($foo, $test);
self::assertEquals('test content', $test->content);
}

public function testReturnsFalseDuringCreationIfAnnotationIsNotRegistered()
{
$event = $this->getFooEvent();
$this->assertFalse($this->parser->onCreateAnnotation($event));
self::assertFalse($this->parser->onCreateAnnotation($event));
}

public function testParserAllowsPassingArrayOfAnnotationInstances()
Expand All @@ -71,8 +71,8 @@ public function testParserAllowsPassingArrayOfAnnotationInstances()
new TestAsset\Foo(),
new TestAsset\Bar(),
]);
$this->assertTrue($this->parser->hasAnnotation(__NAMESPACE__ . '\TestAsset\Foo'));
$this->assertTrue($this->parser->hasAnnotation(__NAMESPACE__ . '\TestAsset\Bar'));
self::assertTrue($this->parser->hasAnnotation(__NAMESPACE__ . '\TestAsset\Foo'));
self::assertTrue($this->parser->hasAnnotation(__NAMESPACE__ . '\TestAsset\Bar'));
}

public function testAllowsSpecifyingAliases()
Expand All @@ -83,9 +83,9 @@ public function testAllowsSpecifyingAliases()

$event = $this->getFooEvent();
$test = $this->parser->onCreateAnnotation($event);
$this->assertInstanceOf(__NAMESPACE__ . '\TestAsset\Bar', $test);
$this->assertNotSame($bar, $test);
$this->assertEquals('test content', $test->content);
self::assertInstanceOf(__NAMESPACE__ . '\TestAsset\Bar', $test);
self::assertNotSame($bar, $test);
self::assertEquals('test content', $test->content);
}

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

public function testRegisterAnnotationsThrowsException()
Expand Down
4 changes: 2 additions & 2 deletions test/Generator/AbstractGeneratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ public function testConstructor()
],
]);

$this->assertInstanceOf(GeneratorInterface::class, $generator);
$this->assertEquals('foo', $generator->getIndentation());
self::assertInstanceOf(GeneratorInterface::class, $generator);
self::assertEquals('foo', $generator->getIndentation());
}

public function testSetOptionsThrowsExceptionOnInvalidArgument()
Expand Down
4 changes: 2 additions & 2 deletions test/Generator/AbstractMemberGeneratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ public function testSetFlagsWithArray()
]
);

$this->assertEquals(AbstractMemberGenerator::VISIBILITY_PUBLIC, $this->fixture->getVisibility());
$this->assertEquals(true, $this->fixture->isFinal());
self::assertEquals(AbstractMemberGenerator::VISIBILITY_PUBLIC, $this->fixture->getVisibility());
self::assertEquals(true, $this->fixture->isFinal());
}

public function testSetDocBlockThrowsExceptionWithInvalidType()
Expand Down
Loading