Skip to content

Commit

Permalink
provide more tests for repositoryClass testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Haehnchen committed Sep 11, 2017
1 parent f9ab2c1 commit 5bf5ef4
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,63 @@ public String getTestDataPath() {
return new File(this.getClass().getResource("fixtures").getFile()).getAbsolutePath();
}

public void testFoo() {
public void testThatInspectionForMissingClassIsProvided() {
assertLocalInspectionContains("test.php", "<?php\n" +
"\n" +
"use Doctrine\\ORM\\Mapping as ORM;\n" +
"\n" +
"/**\n" +
" * @ORM\\En<caret>tity(repositoryClass=\"Foobar\")\n" +
" * @ORM\\Entity(repositoryClass=\"Foo<caret>bar\")\n" +
" */\n" +
"class Foo\n" +
"{\n" +
"}",
RepositoryClassInspection.MESSAGE
);

assertLocalInspectionContains("test.php", "<?php\n" +
"\n" +
"use Doctrine\\ORM\\Mapping as ORM;\n" +
"\n" +
"/**\n" +
" * @ORM\\Entity(\"Foobar\", repositoryClass=\"Foo<caret>bar\")\n" +
" */\n" +
"class Foo\n" +
"{\n" +
"}",
RepositoryClassInspection.MESSAGE
);
}

public void testThatExistingClassIsNotHighlighted() {
assertLocalInspectionContainsNotContains("test.php", "<?php\n" +
"\n" +
"use Doctrine\\ORM\\Mapping as ORM;\n" +
"\n" +
"/**\n" +
" * @ORM\\Entity(repositoryClass=\"Foob<caret>ar\\Foo\")\n" +
" */\n" +
"class Foo\n" +
"{\n" +
"}",
RepositoryClassInspection.MESSAGE
);
}

public void testThatExistingClassInSameNamespaceIsNotHighlighted() {
assertLocalInspectionContainsNotContains("test.php", "<?php\n" +
"\n" +
"namespace Foobar;" +
"" +
"use Doctrine\\ORM\\Mapping as ORM;\n" +
"\n" +
"/**\n" +
" * @ORM\\Entity(repositoryClass=\"F<caret>oo\")\n" +
" */\n" +
"class Bar\n" +
"{\n" +
"}",
RepositoryClassInspection.MESSAGE
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,11 @@
{
interface Annotation {}
class Entity {}
}

namespace Foobar
{
class Foo
{
}
}

0 comments on commit 5bf5ef4

Please sign in to comment.