Index: tests/Zend/CodeGenerator/Php/ClassTest.php =================================================================== --- tests/Zend/CodeGenerator/Php/ClassTest.php (revision 21858) +++ tests/Zend/CodeGenerator/Php/ClassTest.php (working copy) @@ -236,8 +236,7 @@ } /** - * @group ZF-7909 - */ + * @group ZF-7909 */ public function testClassFromReflectionThatImplementsInterfaces() { if(!class_exists('Zend_CodeGenerator_Php_ClassWithInterface')) { @@ -275,4 +274,44 @@ $expectedClassDef = 'class Zend_CodeGenerator_Php_NewClassWithInterface extends Zend_CodeGenerator_Php_ClassWithInterface implements Zend_Code_Generator_Php_ThreeInterface'; $this->assertContains($expectedClassDef, $code); } + + /** + * @group ZF-9602 + */ + public function testSetextendedclassShouldIgnoreEmptyClassnameOnGenerate() + { + $codeGenClass = new Zend_CodeGenerator_Php_Class(); + $codeGenClass->setName( 'MyClass' ) + ->setExtendedClass(''); + + $expected = <<assertEquals( $expected, $codeGenClass->generate() ); + } + + /** + * @group ZF-9602 + */ + public function testSetextendedclassShouldNotIgnoreNonEmptyClassnameOnGenerate() + { + $codeGenClass = new Zend_CodeGenerator_Php_Class(); + $codeGenClass->setName( 'MyClass' ) + ->setExtendedClass('ParentClass'); + + $expected = <<assertEquals( $expected, $codeGenClass->generate() ); + } +} Index: library/Zend/CodeGenerator/Php/Class.php =================================================================== --- library/Zend/CodeGenerator/Php/Class.php (revision 21858) +++ library/Zend/CodeGenerator/Php/Class.php (working copy) @@ -470,8 +470,8 @@ $output .= 'class ' . $this->getName(); - if (null !== ($ec = $this->_extendedClass)) { - $output .= ' extends ' . $ec; + if ( !empty( $this->_extendedClass) ) { + $output .= ' extends ' . $this->_extendedClass; } $implemented = $this->getImplementedInterfaces();