Note that this source locator does NOT specify a filename, because we did not load it from a file, so it will be null if you use this locator.
Inheritance: extends AbstractSourceLocator
 public function testReturnsReflectionWhenSourceHasClass()
 {
     $sourceCode = '<?php class Foo {}';
     $locator = new StringSourceLocator($sourceCode);
     $reflectionClass = $locator->locateIdentifier($this->getMockReflector(), new Identifier('Foo', new IdentifierType(IdentifierType::IDENTIFIER_CLASS)));
     $this->assertSame('Foo', $reflectionClass->getName());
 }
 public function testFetchingFqsenThrowsExceptionWithNonObjectName()
 {
     $sourceLocator = new StringSourceLocator('<?php class Foo {}');
     $reflector = new ClassReflector($sourceLocator);
     $identifier = new Identifier('Foo', new IdentifierType(IdentifierType::IDENTIFIER_CLASS));
     $reflection = $sourceLocator->locateIdentifier($reflector, $identifier);
     $reflectionClassReflection = new \ReflectionClass(ReflectionClass::class);
     $reflectionClassMethodReflection = $reflectionClassReflection->getMethod('getFqsenFromNamedNode');
     $reflectionClassMethodReflection->setAccessible(true);
     $nameNode = new Name(['int']);
     $this->setExpectedException(\Exception::class, 'Unable to determine FQSEN for named node');
     $reflectionClassMethodReflection->invoke($reflection, $nameNode);
 }