Skip to content
Permalink
Browse files

Add skipped test for broken stubbing behaviour

Ref #1935
  • Loading branch information...
muglug committed Jul 11, 2019
1 parent 7268558 commit 7d05568e22ae822ce04cca0e944eaef9e78e5c33
Showing with 91 additions and 0 deletions.
  1. +29 −0 tests/MagicMethodAnnotationTest.php
  2. +50 −0 tests/StubTest.php
  3. +12 −0 tests/fixtures/stubs/templated_class.php
@@ -44,6 +44,35 @@ class Child {}
$this->analyzeFile('somefile.php', new Context());
}
/**
* @return void
*/
public function testPhpDocMethodWhenTemplated()
{
Config::getInstance()->use_phpdoc_method_without_magic_or_parent = true;
$this->addFile(
'somefile.php',
'<?php
/** @template T */
class A {
/** @return ?T */
public function find() {}
}
class B extends A {}
class Obj {}
/**
* @method Obj|null find()
*/
class C extends B {}'
);
$this->analyzeFile('somefile.php', new Context());
}
/**
* @return void
*/
@@ -923,4 +923,54 @@ public function foo(string $a) {
$this->analyzeFile($file_path, new Context());
}
/**
* @return void
*/
public function testStubFileWithTemplatedClassDefinitionAndMagicMethodOverride()
{
$this->markTestSkipped('Currently broken');
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
TestConfig::loadFromXML(
dirname(__DIR__),
'<?xml version="1.0"?>
<psalm>
<projectFiles>
<directory name="src" />
</projectFiles>
<stubs>
<file name="tests/fixtures/stubs/templated_class.php" />
</stubs>
</psalm>'
)
);
$file_path = getcwd() . '/src/somefile.php';
$this->addFile(
$file_path,
'<?php
class A {
/**
* @param int $id
* @param ?int $lockMode
* @param ?int $lockVersion
* @return mixed
*/
public function find($id, $lockMode = null, $lockVersion = null) {}
}
class B extends A {}
class Obj {}
/**
* @method ?Obj find(int $id, $lockMode = null, $lockVersion = null)
*/
class C extends B {}'
);
$this->analyzeFile($file_path, new Context());
}
}
@@ -0,0 +1,12 @@
<?php
/** @template T */
class A {
/**
* @param int $id
* @param ?int $lockMode
* @param ?int $lockVersion
* @return ?T
*/
public function find($id, $lockMode = null, $lockVersion = null) {}
}

0 comments on commit 7d05568

Please sign in to comment.
You can’t perform that action at this time.