Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

BUGFIX Namespaced classes were always having their namespace prepende…

…d to their base class
  • Loading branch information...
commit 27a51ed7edccd18a3f0242056660f8adbc1d1087 1 parent 53506f3
@simonwelsh simonwelsh authored
View
2  core/manifest/ClassManifest.php
@@ -354,7 +354,7 @@ public function handleFile($basename, $pathname, $depth) {
$extends = isset($class['extends']) ? implode('', $class['extends']) : null;
$implements = isset($class['interfaces']) ? $class['interfaces'] : null;
- if($extends && $extends[0] != '/\\') {
+ if($extends && $extends[0] != '\\') {
$extends = $namespace . $extends;
} elseif($extends) {
$extends = substr($extends, 1);
View
11 tests/core/manifest/NamespacedClassManifestTest.php
@@ -44,7 +44,8 @@ public function testGetClasses() {
'sapphire\test\classd' => "{$this->base}/module/classes/ClassD.php",
'sapphire\test\classe' => "{$this->base}/module/classes/ClassE.php",
'sapphire\test\classf' => "{$this->base}/module/classes/ClassF.php",
- 'sapphire\test\classg' => "{$this->base}/module/classes/ClassG.php"
+ 'sapphire\test\classg' => "{$this->base}/module/classes/ClassG.php",
+ 'sapphire\test\classh' => "{$this->base}/module/classes/ClassH.php"
);
$this->assertEquals($expect, $this->manifest->getClasses());
@@ -52,13 +53,13 @@ public function testGetClasses() {
public function testGetClassNames() {
$this->assertEquals(
- array('sapphire\test\classa', 'sapphire\test\classb', 'sapphire\test\classc', 'sapphire\test\classd', 'sapphire\test\classe', 'sapphire\test\classf', 'sapphire\test\classg'),
+ array('sapphire\test\classa', 'sapphire\test\classb', 'sapphire\test\classc', 'sapphire\test\classd', 'sapphire\test\classe', 'sapphire\test\classf', 'sapphire\test\classg', 'sapphire\test\classh'),
$this->manifest->getClassNames());
}
public function testGetDescendants() {
$expect = array(
- 'sapphire\test\classa' => array('sapphire\test\ClassB')
+ 'sapphire\test\classa' => array('sapphire\test\ClassB', 'sapphire\test\ClassH'),
);
$this->assertEquals($expect, $this->manifest->getDescendants());
@@ -66,8 +67,8 @@ public function testGetDescendants() {
public function testGetDescendantsOf() {
$expect = array(
- 'SAPPHIRE\TEST\CLASSA' => array('sapphire\test\ClassB'),
- 'sapphire\test\classa' => array('sapphire\test\ClassB'),
+ 'SAPPHIRE\TEST\CLASSA' => array('sapphire\test\ClassB', 'sapphire\test\ClassH'),
+ 'sapphire\test\classa' => array('sapphire\test\ClassB', 'sapphire\test\ClassH'),
);
foreach ($expect as $class => $desc) {
View
8 tests/core/manifest/fixtures/namespaced_classmanifest/module/classes/ClassH.php
@@ -0,0 +1,8 @@
+<?php
+/**
+ * @ignore
+ */
+
+namespace sapphire\test;
+
+class ClassH extends \sapphire\test\ClassA { }

0 comments on commit 27a51ed

Please sign in to comment.
Something went wrong with that request. Please try again.