Skip to content
This repository was archived by the owner on Feb 14, 2021. It is now read-only.

Commit 7d67182

Browse files
committed
Implemented PSR0Resource::getSrcClassname().
1 parent 2b8bd12 commit 7d67182

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

spec/PhpSpec/Symfony2Extension/Locator/PSR0ResourceSpec.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,26 @@ function it_generates_the_src_namespace_from_provided_parts_using_the_locator(Lo
4949
$this->getSrcNamespace()->shouldReturn('Local\\Acme\\Bundle\\DemoBundle\\Model');
5050
}
5151

52-
function it_generates_proper_src_namespace_even_if_there_is_only_one_part(Locator $locator)
52+
function it_generates_a_proper_src_namespace_even_if_there_is_only_one_part(Locator $locator)
5353
{
5454
$this->beConstructedWith(array('config'), $locator);
5555

5656
$locator->getSrcNamespace()->willReturn('Local\\');
5757

5858
$this->getSrcNamespace()->shouldReturn('Local');
5959
}
60+
61+
function it_generates_the_src_classname_from_provided_parts_using_the_locator(Locator $locator)
62+
{
63+
$locator->getSrcNamespace()->willReturn('Local\\');
64+
65+
$this->getSrcClassname()->shouldReturn('Local\\Acme\\Bundle\\DemoBundle\\Model\\User');
66+
}
67+
68+
function it_generates_a_proper_src_classname_for_an_empty_locator_namespace(Locator $locator)
69+
{
70+
$locator->getSrcNamespace()->willReturn('');
71+
72+
$this->getSrcClassname()->shouldReturn('Acme\\Bundle\\DemoBundle\\Model\\User');
73+
}
6074
}

src/PhpSpec/Symfony2Extension/Locator/PSR0Resource.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function getSrcNamespace()
5252

5353
public function getSrcClassname()
5454
{
55-
// @todo: Implement getSrcClassname() method.
55+
return $this->locator->getSrcNamespace().implode('\\', $this->parts);
5656
}
5757

5858
public function getSpecFilename()

0 commit comments

Comments
 (0)