createTraitBuilder('TestTrait') ->setDocComment('/** Nice trait */') ->addStmt($method1) ->addStmts(array($method2, $method3)) ->getNode(); $this->assertEquals(new Stmt\Trait_('TestTrait', array( $method1, $method2, $method3 ), array( 'comments' => array( new Comment\Doc('/** Nice trait */') ) )), $trait); } /** * @expectedException \LogicException * @expectedExceptionMessage Unexpected node of type "Stmt_Echo" */ public function testInvalidStmtError() { $this->createTraitBuilder('Test') ->addStmt(new Stmt\Echo_(array())) ; } }