How to use AstNodeTest class

Best Cucumber Common Library code snippet using AstNodeTest

ASTVariableDeclaratorTest.php

Source:ASTVariableDeclaratorTest.php Github

copy

Full Screen

1<?php2/**3 * This file is part of PHP_Depend.4 *5 * PHP Version 56 *7 * Copyright (c) 2008-2009, Manuel Pichler <mapi@pdepend.org>.8 * All rights reserved.9 *10 * Redistribution and use in source and binary forms, with or without11 * modification, are permitted provided that the following conditions12 * are met:13 *14 * * Redistributions of source code must retain the above copyright15 * notice, this list of conditions and the following disclaimer.16 *17 * * Redistributions in binary form must reproduce the above copyright18 * notice, this list of conditions and the following disclaimer in19 * the documentation and/or other materials provided with the20 * distribution.21 *22 * * Neither the name of Manuel Pichler nor the names of his23 * contributors may be used to endorse or promote products derived24 * from this software without specific prior written permission.25 *26 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS27 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT28 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS29 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE30 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,31 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,32 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;33 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER34 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN36 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE37 * POSSIBILITY OF SUCH DAMAGE.38 *39 * @category PHP40 * @package PHP_Depend41 * @subpackage Code42 * @author Manuel Pichler <mapi@pdepend.org>43 * @copyright 2008-2009 Manuel Pichler. All rights reserved.44 * @license http://www.opensource.org/licenses/bsd-license.php BSD License45 * @version SVN: $Id$46 * @link http://www.pdepend.org/47 */48require_once 'PHP/Depend/Code/ASTNodeTest.php';49require_once 'PHP/Depend/Code/ASTVariableDeclarator.php';50/**51 * Test case for the {@link PHP_Depend_Code_ASTVariableDeclarator} class.52 *53 * @category PHP54 * @package PHP_Depend55 * @subpackage Code56 * @author Manuel Pichler <mapi@pdepend.org>57 * @copyright 2008-2009 Manuel Pichler. All rights reserved.58 * @license http://www.opensource.org/licenses/bsd-license.php BSD License59 * @version Release: 0.9.760 * @link http://www.pdepend.org/61 */62class PHP_Depend_Code_ASTVariableDeclaratorTest extends PHP_Depend_Code_ASTNodeTest63{64 /**65 * Tests that the declaration has the expected start line value.66 *67 * @return void68 */69 public function testVariableDeclaratorHasExpectedStartLine()70 {71 $packages = self::parseTestCaseSource(__METHOD__);72 $function = $packages->current()73 ->getFunctions()74 ->current();75 $declarators = $function->findChildrenOfType(76 PHP_Depend_Code_ASTVariableDeclarator::CLAZZ77 );78 $this->assertSame(4, $declarators[0]->getStartLine());79 $this->assertSame(5, $declarators[1]->getStartLine());80 }81 /**82 * Tests that the declaration has the expected start column value.83 *84 * @return void85 */86 public function testVariableDeclaratorHasExpectedStartColumn()87 {88 $packages = self::parseTestCaseSource(__METHOD__);89 $function = $packages->current()90 ->getFunctions()91 ->current();92 $declarators = $function->findChildrenOfType(93 PHP_Depend_Code_ASTVariableDeclarator::CLAZZ94 );95 $this->assertSame(12, $declarators[0]->getStartColumn());96 $this->assertSame(5, $declarators[1]->getStartColumn());97 }98 /**99 * Tests that the declaration has the expected end line value.100 *101 * @return void102 */103 public function testVariableDeclaratorHasExpectedEndLine()104 {105 $packages = self::parseTestCaseSource(__METHOD__);106 $function = $packages->current()107 ->getFunctions()108 ->current();109 $declarator = $function->getFirstChildOfType(110 PHP_Depend_Code_ASTVariableDeclarator::CLAZZ111 );112 $this->assertSame(7, $declarator->getEndLine());113 }114 /**115 * Tests that the declaration has the expected end column value.116 *117 * @return void118 */119 public function testVariableDeclaratorHasExpectedEndColumn()120 {121 $packages = self::parseTestCaseSource(__METHOD__);122 $function = $packages->current()123 ->getFunctions()124 ->current();125 $declarator = $function->getFirstChildOfType(126 PHP_Depend_Code_ASTVariableDeclarator::CLAZZ127 );128 $this->assertSame(17, $declarator->getEndColumn());129 }130 /**131 * Creates a field declaration node.132 *133 * @return PHP_Depend_Code_ASTVariableDeclarator134 */135 protected function createNodeInstance()136 {137 return new PHP_Depend_Code_ASTVariableDeclarator('$foo');138 }139}140?>...

Full Screen

Full Screen

ASTStaticVariableDeclarationTest.php

Source:ASTStaticVariableDeclarationTest.php Github

copy

Full Screen

1<?php2/**3 * This file is part of PHP_Depend.4 *5 * PHP Version 56 *7 * Copyright (c) 2008-2009, Manuel Pichler <mapi@pdepend.org>.8 * All rights reserved.9 *10 * Redistribution and use in source and binary forms, with or without11 * modification, are permitted provided that the following conditions12 * are met:13 *14 * * Redistributions of source code must retain the above copyright15 * notice, this list of conditions and the following disclaimer.16 *17 * * Redistributions in binary form must reproduce the above copyright18 * notice, this list of conditions and the following disclaimer in19 * the documentation and/or other materials provided with the20 * distribution.21 *22 * * Neither the name of Manuel Pichler nor the names of his23 * contributors may be used to endorse or promote products derived24 * from this software without specific prior written permission.25 *26 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS27 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT28 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS29 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE30 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,31 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,32 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;33 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER34 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN36 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE37 * POSSIBILITY OF SUCH DAMAGE.38 *39 * @category PHP40 * @package PHP_Depend41 * @subpackage Code42 * @author Manuel Pichler <mapi@pdepend.org>43 * @copyright 2008-2009 Manuel Pichler. All rights reserved.44 * @license http://www.opensource.org/licenses/bsd-license.php BSD License45 * @version SVN: $Id$46 * @link http://www.pdepend.org/47 */48require_once 'PHP/Depend/Code/ASTNodeTest.php';49/**50 * Test case for the {@link PHP_Depend_Code_ASTStaticVariableDeclaration} class.51 *52 * @category PHP53 * @package PHP_Depend54 * @subpackage Code55 * @author Manuel Pichler <mapi@pdepend.org>56 * @copyright 2008-2009 Manuel Pichler. All rights reserved.57 * @license http://www.opensource.org/licenses/bsd-license.php BSD License58 * @version Release: 0.9.759 * @link http://www.pdepend.org/60 */61class PHP_Depend_Code_ASTStaticVariableDeclarationTest extends PHP_Depend_Code_ASTNodeTest62{63 /**64 * Tests that the declaration has the expected start line value.65 * 66 * @return void67 */68 public function testStaticVariableDeclarationHasExpectedStartLine()69 {70 $packages = self::parseTestCaseSource(__METHOD__);71 $function = $packages->current()72 ->getFunctions()73 ->current();74 $declaration = $function->getFirstChildOfType(75 PHP_Depend_Code_ASTStaticVariableDeclaration::CLAZZ76 );77 $this->assertSame(4, $declaration->getStartLine());78 }79 /**80 * Tests that the declaration has the expected start column value.81 *82 * @return void83 */84 public function testStaticVariableDeclarationHasExpectedStartColumn()85 {86 $packages = self::parseTestCaseSource(__METHOD__);87 $function = $packages->current()88 ->getFunctions()89 ->current();90 $declaration = $function->getFirstChildOfType(91 PHP_Depend_Code_ASTStaticVariableDeclaration::CLAZZ92 );93 $this->assertSame(5, $declaration->getStartColumn());94 }95 /**96 * Tests that the declaration has the expected end line value.97 *98 * @return void99 */100 public function testStaticVariableDeclarationHasExpectedEndLine()101 {102 $packages = self::parseTestCaseSource(__METHOD__);103 $function = $packages->current()104 ->getFunctions()105 ->current();106 $declaration = $function->getFirstChildOfType(107 PHP_Depend_Code_ASTStaticVariableDeclaration::CLAZZ108 );109 $this->assertSame(5, $declaration->getEndLine());110 }111 /**112 * Tests that the declaration has the expected end column value.113 *114 * @return void115 */116 public function testStaticVariableDeclarationHasExpectedEndColumn()117 {118 $packages = self::parseTestCaseSource(__METHOD__);119 $function = $packages->current()120 ->getFunctions()121 ->current();122 $declaration = $function->getFirstChildOfType(123 PHP_Depend_Code_ASTStaticVariableDeclaration::CLAZZ124 );125 $this->assertSame(23, $declaration->getEndColumn());126 }127 /**128 * Creates a static variable declaration node.129 *130 * @return PHP_Depend_Code_ASTStaticVariableDeclaration131 */132 protected function createNodeInstance()133 {134 return new PHP_Depend_Code_ASTStaticVariableDeclaration(__FUNCTION__);135 }136}...

Full Screen

Full Screen

ASTConstantPostfixTest.php

Source:ASTConstantPostfixTest.php Github

copy

Full Screen

1<?php2/**3 * This file is part of PHP_Depend.4 *5 * PHP Version 56 *7 * Copyright (c) 2008-2009, Manuel Pichler <mapi@pdepend.org>.8 * All rights reserved.9 *10 * Redistribution and use in source and binary forms, with or without11 * modification, are permitted provided that the following conditions12 * are met:13 *14 * * Redistributions of source code must retain the above copyright15 * notice, this list of conditions and the following disclaimer.16 *17 * * Redistributions in binary form must reproduce the above copyright18 * notice, this list of conditions and the following disclaimer in19 * the documentation and/or other materials provided with the20 * distribution.21 *22 * * Neither the name of Manuel Pichler nor the names of his23 * contributors may be used to endorse or promote products derived24 * from this software without specific prior written permission.25 *26 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS27 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT28 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS29 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE30 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,31 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,32 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;33 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER34 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN36 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE37 * POSSIBILITY OF SUCH DAMAGE.38 *39 * @category PHP40 * @package PHP_Depend41 * @subpackage Code42 * @author Manuel Pichler <mapi@pdepend.org>43 * @copyright 2008-2009 Manuel Pichler. All rights reserved.44 * @license http://www.opensource.org/licenses/bsd-license.php BSD License45 * @version SVN: $Id$46 * @link http://www.pdepend.org/47 */48require_once dirname(__FILE__) . '/ASTNodeTest.php';49require_once 'PHP/Depend/Code/ASTConstantPostfix.php';50/**51 * Test case for the {@link PHP_Depend_Code_ASTConstantPostfix} class.52 *53 * @category PHP54 * @package PHP_Depend55 * @subpackage Code56 * @author Manuel Pichler <mapi@pdepend.org>57 * @copyright 2008-2009 Manuel Pichler. All rights reserved.58 * @license http://www.opensource.org/licenses/bsd-license.php BSD License59 * @version Release: 0.9.760 * @link http://www.pdepend.org/61 */62class PHP_Depend_Code_ASTConstantPostfixTest extends PHP_Depend_Code_ASTNodeTest63{64 /**65 * Tests that a parsed constant postfix has the expected object structure.66 *67 * @return void68 */69 public function testConstantPostfixStructureForSimpleStaticAccess()70 {71 $packages = self::parseTestCaseSource(__METHOD__);72 $function = $packages->current()73 ->getFunctions()74 ->current();75 $prefix = $function->getFirstChildOfType(76 PHP_Depend_Code_ASTMemberPrimaryPrefix::CLAZZ77 );78 $reference = $prefix->getChild(0);79 $this->assertType(PHP_Depend_Code_ASTClassOrInterfaceReference::CLAZZ, $reference);80 $this->assertSame('Bar', $reference->getImage());81 $postfix = $prefix->getChild(1);82 $this->assertType(PHP_Depend_Code_ASTConstantPostfix::CLAZZ, $postfix);83 $this->assertSame('BAZ', $postfix->getImage());84 $identifier = $postfix->getChild(0);85 $this->assertType(PHP_Depend_Code_ASTIdentifier::CLAZZ, $identifier);86 $this->assertSame('BAZ', $identifier->getImage());87 }88 /**89 * Tests that a parsed method postfix has the expected object structure.90 *91 * @return void92 */93 public function testConstantPostfixStructureForStaticAccessOnVariable()94 {95 $packages = self::parseTestCaseSource(__METHOD__);96 $function = $packages->current()97 ->getFunctions()98 ->current();99 $prefix = $function->getFirstChildOfType(100 PHP_Depend_Code_ASTMemberPrimaryPrefix::CLAZZ101 );102 $variable = $prefix->getChild(0);103 $this->assertType(PHP_Depend_Code_ASTVariable::CLAZZ, $variable);104 $this->assertSame('::', $prefix->getImage());105 $postfix = $prefix->getChild(1);106 $this->assertType(PHP_Depend_Code_ASTConstantPostfix::CLAZZ, $postfix);107 $identifier = $postfix->getChild(0);108 $this->assertType(PHP_Depend_Code_ASTIdentifier::CLAZZ, $identifier);109 }110 /**111 * Creates a constant postfix node.112 *113 * @return PHP_Depend_Code_ASTConstantPostfix114 */115 protected function createNodeInstance()116 {117 return new PHP_Depend_Code_ASTConstantPostfix(__FUNCTION__);118 }119}...

Full Screen

Full Screen

ASTConstantTest.php

Source:ASTConstantTest.php Github

copy

Full Screen

1<?php2/**3 * This file is part of PHP_Depend.4 *5 * PHP Version 56 *7 * Copyright (c) 2008-2009, Manuel Pichler <mapi@pdepend.org>.8 * All rights reserved.9 *10 * Redistribution and use in source and binary forms, with or without11 * modification, are permitted provided that the following conditions12 * are met:13 *14 * * Redistributions of source code must retain the above copyright15 * notice, this list of conditions and the following disclaimer.16 *17 * * Redistributions in binary form must reproduce the above copyright18 * notice, this list of conditions and the following disclaimer in19 * the documentation and/or other materials provided with the20 * distribution.21 *22 * * Neither the name of Manuel Pichler nor the names of his23 * contributors may be used to endorse or promote products derived24 * from this software without specific prior written permission.25 *26 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS27 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT28 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS29 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE30 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,31 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,32 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;33 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER34 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN36 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE37 * POSSIBILITY OF SUCH DAMAGE.38 *39 * @category PHP40 * @package PHP_Depend41 * @subpackage Code42 * @author Manuel Pichler <mapi@pdepend.org>43 * @copyright 2008-2009 Manuel Pichler. All rights reserved.44 * @license http://www.opensource.org/licenses/bsd-license.php BSD License45 * @version SVN: $Id$46 * @link http://www.pdepend.org/47 */48require_once dirname(__FILE__) . '/ASTNodeTest.php';49require_once 'PHP/Depend/Code/ASTConstant.php';50/**51 * Test case for the {@link PHP_Depend_Code_ASTConstant} class.52 *53 * @category PHP54 * @package PHP_Depend55 * @subpackage Code56 * @author Manuel Pichler <mapi@pdepend.org>57 * @copyright 2008-2009 Manuel Pichler. All rights reserved.58 * @license http://www.opensource.org/licenses/bsd-license.php BSD License59 * @version Release: 0.9.760 * @link http://www.pdepend.org/61 */62class PHP_Depend_Code_ASTConstantTest extends PHP_Depend_Code_ASTNodeTest63{64 /**65 * Tests that a parsed constant has the expected object graph.66 *67 * @return void68 */69 public function testConstantGraphSimple()70 {71 $packages = self::parseTestCaseSource(__METHOD__);72 $function = $packages73 ->current()74 ->getFunctions()75 ->current();76 $constant = $function->getFirstChildOfType(77 PHP_Depend_Code_ASTConstant::CLAZZ78 );79 80 $this->assertType(PHP_Depend_Code_ASTConstant::CLAZZ, $constant);81 $this->assertSame('FOO', $constant->getImage());82 }83 /**84 * Tests that a parsed constant has the expected object graph.85 *86 * @return void87 */88 public function testConstantGraphKeywordSelf()89 {90 $packages = self::parseTestCaseSource(__METHOD__);91 $function = $packages92 ->current()93 ->getFunctions()94 ->current();95 $constant = $function->getFirstChildOfType(96 PHP_Depend_Code_ASTConstant::CLAZZ97 );98 $this->assertType(PHP_Depend_Code_ASTConstant::CLAZZ, $constant);99 $this->assertSame('self', $constant->getImage());100 }101 /**102 * Tests that a parsed constant has the expected object graph.103 *104 * @return void105 */106 public function testConstantGraphKeywordParent()107 {108 $packages = self::parseTestCaseSource(__METHOD__);109 $function = $packages110 ->current()111 ->getFunctions()112 ->current();113 $constant = $function->getFirstChildOfType(114 PHP_Depend_Code_ASTConstant::CLAZZ115 );116 $this->assertType(PHP_Depend_Code_ASTConstant::CLAZZ, $constant);117 $this->assertSame('parent', $constant->getImage());118 }119 /**120 * Creates a constant postfix node.121 *122 * @return PHP_Depend_Code_ASTConstant123 */124 protected function createNodeInstance()125 {126 return new PHP_Depend_Code_ASTConstant(__FUNCTION__);127 }128}...

Full Screen

Full Screen

ASTStaticReferenceTest.php

Source:ASTStaticReferenceTest.php Github

copy

Full Screen

1<?php2/**3 * This file is part of PHP_Depend.4 *5 * PHP Version 56 *7 * Copyright (c) 2008-2009, Manuel Pichler <mapi@pdepend.org>.8 * All rights reserved.9 *10 * Redistribution and use in source and binary forms, with or without11 * modification, are permitted provided that the following conditions12 * are met:13 *14 * * Redistributions of source code must retain the above copyright15 * notice, this list of conditions and the following disclaimer.16 *17 * * Redistributions in binary form must reproduce the above copyright18 * notice, this list of conditions and the following disclaimer in19 * the documentation and/or other materials provided with the20 * distribution.21 *22 * * Neither the name of Manuel Pichler nor the names of his23 * contributors may be used to endorse or promote products derived24 * from this software without specific prior written permission.25 *26 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS27 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT28 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS29 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE30 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,31 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,32 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;33 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER34 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN36 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE37 * POSSIBILITY OF SUCH DAMAGE.38 *39 * @category PHP40 * @package PHP_Depend41 * @subpackage Code42 * @author Manuel Pichler <mapi@pdepend.org>43 * @copyright 2008-2009 Manuel Pichler. All rights reserved.44 * @license http://www.opensource.org/licenses/bsd-license.php BSD License45 * @version SVN: $Id$46 * @link http://www.pdepend.org/47 */48require_once dirname(__FILE__) . '/ASTNodeTest.php';49require_once 'PHP/Depend/Code/ASTStaticReference.php';50require_once 'PHP/Depend/Code/Class.php';51/**52 * Test case for the {@link PHP_Depend_Code_ASTStaticReference} class.53 *54 * @category PHP55 * @package PHP_Depend56 * @subpackage Code57 * @author Manuel Pichler <mapi@pdepend.org>58 * @copyright 2008-2009 Manuel Pichler. All rights reserved.59 * @license http://www.opensource.org/licenses/bsd-license.php BSD License60 * @version Release: 0.9.761 * @link http://www.pdepend.org/62 */63class PHP_Depend_Code_ASTStaticReferenceTest extends PHP_Depend_Code_ASTNodeTest64{65 /**66 * Tests that an invalid static results in the expected exception.67 *68 * @return void69 */70 public function testStaticReferenceAllocationOutsideOfClassScopeThrowsExpectedException()71 {72 $this->setExpectedException(73 'PHP_Depend_Parser_InvalidStateException',74 'The keyword "static" was used outside of a class/method scope.'75 );76 $packages = self::parseTestCaseSource(__METHOD__);77 }78 /**79 * Tests that an invalid static results in the expected exception.80 *81 * @return void82 */83 public function testStaticReferenceMemberPrimaryPrefixOutsideOfClassScopeThrowsExpectedException()84 {85 $this->setExpectedException(86 'PHP_Depend_Parser_InvalidStateException',87 'The keyword "static" was used outside of a class/method scope.'88 );89 $packages = self::parseTestCaseSource(__METHOD__);90 }91 /**92 * Creates a concrete node implementation.93 *94 * @return PHP_Depend_Code_ASTStaticReference95 */96 protected function createNodeInstance()97 {98 return new PHP_Depend_Code_ASTStaticReference(99 $this->getMock(100 'PHP_Depend_Code_Class',101 array(),102 array(__CLASS__)103 )104 );105 }106}...

Full Screen

Full Screen

ASTLiteralTest.php

Source:ASTLiteralTest.php Github

copy

Full Screen

1<?php2/**3 * This file is part of PHP_Depend.4 *5 * PHP Version 56 *7 * Copyright (c) 2008-2009, Manuel Pichler <mapi@pdepend.org>.8 * All rights reserved.9 *10 * Redistribution and use in source and binary forms, with or without11 * modification, are permitted provided that the following conditions12 * are met:13 *14 * * Redistributions of source code must retain the above copyright15 * notice, this list of conditions and the following disclaimer.16 *17 * * Redistributions in binary form must reproduce the above copyright18 * notice, this list of conditions and the following disclaimer in19 * the documentation and/or other materials provided with the20 * distribution.21 *22 * * Neither the name of Manuel Pichler nor the names of his23 * contributors may be used to endorse or promote products derived24 * from this software without specific prior written permission.25 *26 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS27 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT28 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS29 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE30 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,31 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,32 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;33 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER34 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN36 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE37 * POSSIBILITY OF SUCH DAMAGE.38 *39 * @category PHP40 * @package PHP_Depend41 * @subpackage Code42 * @author Manuel Pichler <mapi@pdepend.org>43 * @copyright 2008-2009 Manuel Pichler. All rights reserved.44 * @license http://www.opensource.org/licenses/bsd-license.php BSD License45 * @version SVN: $Id$46 * @link http://www.pdepend.org/47 */48require_once dirname(__FILE__) . '/ASTNodeTest.php';49require_once 'PHP/Depend/Code/ASTLiteral.php';50/**51 * Test case for the {@link PHP_Depend_Code_ASTLiteral} class.52 *53 * @category PHP54 * @package PHP_Depend55 * @subpackage Code56 * @author Manuel Pichler <mapi@pdepend.org>57 * @copyright 2008-2009 Manuel Pichler. All rights reserved.58 * @license http://www.opensource.org/licenses/bsd-license.php BSD License59 * @version Release: 0.9.760 * @link http://www.pdepend.org/61 */62class PHP_Depend_Code_ASTLiteralTest extends PHP_Depend_Code_ASTNodeTest63{64 /**65 * Tests that an invalid literal results in the expected exception.66 * 67 * @return void68 */69 public function testUnclosedDoubleQuoteStringResultsInExpectedException()70 {71 $this->setExpectedException('PHP_Depend_Parser_TokenStreamEndException');72 self::parseTestCaseSource(__METHOD__);73 }74 /**75 * Creates a literal node.76 *77 * @return PHP_Depend_Code_ASTLiteral78 */79 protected function createNodeInstance()80 {81 return new PHP_Depend_Code_ASTLiteral("'" . __METHOD__ . "'");82 }83}...

Full Screen

Full Screen

ASTNodeTest.php

Source:ASTNodeTest.php Github

copy

Full Screen

1<?php2/**3 * This file is part of PHP Mess Detector.4 *5 * Copyright (c) Manuel Pichler <mapi@phpmd.org>.6 * All rights reserved.7 *8 * Licensed under BSD License9 * For full copyright and license information, please see the LICENSE file.10 * Redistributions of files must retain the above copyright notice.11 *12 * @author Manuel Pichler <mapi@phpmd.org>13 * @copyright Manuel Pichler. All rights reserved.14 * @license https://opensource.org/licenses/bsd-license.php BSD License15 * @link http://phpmd.org/16 */17namespace PHPMD\Node;18use PHPMD\AbstractTest;19/**20 * Test case for the {@link \PHPMD\Node\ASTNode} class.21 *22 * @covers \PHPMD\Node\ASTNode23 */24class ASTNodeTest extends AbstractTest25{26 /**27 * testGetImageDelegatesToGetImageMethodOfWrappedNode28 *29 * @return void30 */31 public function testGetImageDelegatesToGetImageMethodOfWrappedNode()32 {33 $mock = $this->getMockFromBuilder($this->getMockBuilder('PDepend\Source\AST\ASTNode'));34 $mock->expects($this->once())35 ->method('getImage');36 $node = new ASTNode($mock, __FILE__);37 $node->getImage();38 }39 /**40 * testGetNameDelegatesToGetImageMethodOfWrappedNode41 *42 * @return void43 */44 public function testGetNameDelegatesToGetImageMethodOfWrappedNode()45 {46 $mock = $this->getMockFromBuilder($this->getMockBuilder('PDepend\Source\AST\ASTNode'));47 $mock->expects($this->once())48 ->method('getImage');49 $node = new ASTNode($mock, __FILE__);50 $node->getName();51 }52 /**53 * testHasSuppressWarningsAnnotationForAlwaysReturnsFalse54 *55 * @return void56 */57 public function testHasSuppressWarningsAnnotationForAlwaysReturnsFalse()58 {59 $mock = $this->getMockFromBuilder($this->getMockBuilder('PDepend\Source\AST\ASTNode'));60 $node = new ASTNode($mock, __FILE__);61 $rule = $this->getRuleMock();62 $this->assertFalse($node->hasSuppressWarningsAnnotationFor($rule));63 }64 /**65 * testGetParentNameReturnsNull66 *67 * @return void68 */69 public function testGetParentNameReturnsNull()70 {71 $mock = $this->getMockFromBuilder($this->getMockBuilder('PDepend\Source\AST\ASTNode'));72 $node = new ASTNode($mock, __FILE__);73 $this->assertNull($node->getParentName());74 }75 /**76 * testGetNamespaceNameReturnsNull77 *78 * @return void79 */80 public function testGetNamespaceNameReturnsNull()81 {82 $mock = $this->getMockFromBuilder($this->getMockBuilder('PDepend\Source\AST\ASTNode'));83 $node = new ASTNode($mock, __FILE__);84 $this->assertNull($node->getNamespaceName());85 }86 /**87 * testGetFullQualifiedNameReturnsNull88 *89 * @return void90 */91 public function testGetFullQualifiedNameReturnsNull()92 {93 $mock = $this->getMockFromBuilder($this->getMockBuilder('PDepend\Source\AST\ASTNode'));94 $node = new ASTNode($mock, __FILE__);95 $this->assertNull($node->getFullQualifiedName());96 }97}...

Full Screen

Full Screen

ASTPrimitiveTypeTest.php

Source:ASTPrimitiveTypeTest.php Github

copy

Full Screen

1<?php2/**3 * This file is part of PDepend.4 *5 * PHP Version 56 *7 * Copyright (c) 2008-2013, Manuel Pichler <mapi@pdepend.org>.8 * All rights reserved.9 *10 * Redistribution and use in source and binary forms, with or without11 * modification, are permitted provided that the following conditions12 * are met:13 *14 * * Redistributions of source code must retain the above copyright15 * notice, this list of conditions and the following disclaimer.16 *17 * * Redistributions in binary form must reproduce the above copyright18 * notice, this list of conditions and the following disclaimer in19 * the documentation and/or other materials provided with the20 * distribution.21 *22 * * Neither the name of Manuel Pichler nor the names of his23 * contributors may be used to endorse or promote products derived24 * from this software without specific prior written permission.25 *26 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS27 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT28 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS29 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE30 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,31 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,32 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;33 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER34 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN36 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE37 * POSSIBILITY OF SUCH DAMAGE.38 *39 * @copyright 2008-2013 Manuel Pichler. All rights reserved.40 * @license http://www.opensource.org/licenses/bsd-license.php BSD License41 */42namespace PDepend\Source\AST;43/**44 * Test case for the {@link \PDepend\Source\AST\ASTPrimitiveType} class.45 *46 * @copyright 2008-2013 Manuel Pichler. All rights reserved.47 * @license http://www.opensource.org/licenses/bsd-license.php BSD License48 *49 * @covers \PDepend\Source\Language\PHP\AbstractPHPParser50 * @covers \PDepend\Source\AST\ASTPrimitiveType51 * @group unittest52 */53class ASTPrimitiveTypeTest extends \PDepend\Source\AST\ASTNodeTest54{55 /**56 * testIsArrayReturnsFalse57 *58 * @return void59 */60 public function testIsArrayReturnsFalse()61 {62 $type = new \PDepend\Source\AST\ASTPrimitiveType();63 $this->assertFalse($type->isArray());64 }65 /**66 * testIsPrimitiveReturnsTrue67 *68 * @return void69 */70 public function testIsPrimitiveReturnsTrue()71 {72 $type = new \PDepend\Source\AST\ASTPrimitiveType();73 $this->assertTrue($type->isPrimitive());74 }75}...

Full Screen

Full Screen

AstNodeTest

Using AI Code Generation

copy

Full Screen

1require_once(__DIR__ . '/vendor/autoload.php');2use Behat\Gherkin\Node\PyStringNode;3use Behat\Gherkin\Node\TableNode;4use Behat\Behat\Context\Context;5use Behat\Behat\Tester\Exception\PendingException;6use Behat\Behat\Context\SnippetAcceptingContext;7use Behat\Behat\Context\CustomSnippetAcceptingContext;8use Behat\Behat\Context\TranslatedContextInterface;9use Behat\Behat\Hook\Scope\BeforeScenarioScope;10use Behat\Behat\Hook\Scope\AfterScenarioScope;11use Behat\Behat\Hook\Scope\BeforeStepScope;12use Behat\Behat\Hook\Scope\AfterStepScope;13use Behat\Behat\Hook\Scope\BeforeFeatureScope;14use Behat\Behat\Hook\Scope\AfterFeatureScope;15use Behat\MinkExtension\Context\MinkContext;16use Behat\MinkExtension\Context\RawMinkContext;17use Behat\Mink\Exception\ElementNotFoundException;18use Behat\Mink\Exception\UnsupportedDriverActionException;19use Behat\Mink\Exception\ExpectationException;20use Behat\Mink\Exception\DriverException;21use Behat\Mink\Exception\ResponseTextException;22use Behat\Mink\Exception\ElementHtmlException;23use Behat\Mink\Exception\ElementTextException;24use Behat\Mink\Exception\DriverException as MinkDriverException;25use Behat\Behat\Context\CustomSnippetAcceptingContext as CustomSnippetAcceptingContextInterface;26use Behat\Behat\Hook\Scope\BeforeScenarioScope as BeforeScenarioScopeInterface;27use Behat\Behat\Hook\Scope\AfterScenarioScope as AfterScenarioScopeInterface;28use Behat\Behat\Hook\Scope\BeforeStepScope as BeforeStepScopeInterface;29use Behat\Behat\Hook\Scope\AfterStepScope as AfterStepScopeInterface;30use Behat\Behat\Hook\Scope\BeforeFeatureScope as BeforeFeatureScopeInterface;31use Behat\Behat\Hook\Scope\AfterFeatureScope as AfterFeatureScopeInterface;32use Behat\Behat\Hook\Scope\BeforeSuiteScope as BeforeSuiteScopeInterface;33use Behat\Behat\Hook\Scope\AfterSuiteScope as AfterSuiteScopeInterface;

Full Screen

Full Screen

AstNodeTest

Using AI Code Generation

copy

Full Screen

1include 'vendor/autoload.php';2use Cucumber\AstNodeTest;3use Behat\Gherkin\Node\FeatureNode;4use Behat\Gherkin\Node\ScenarioNode;5use Behat\Gherkin\Node\StepNode;6$featureFile = file_get_contents('features/feature1.feature');7$featureFile = trim($featureFile);8$featureNode = new FeatureNode($featureFile);9$scenarioNode = $featureNode->getScenarios()[0];10$stepNode = $scenarioNode->getSteps()[0];11$tagNode = $featureNode->getTags()[0];12$backgroundNode = $featureNode->getBackground();13$examplesNode = $scenarioNode->getExamples()[0];14$tableNode = $examplesNode->getOutlineTable();15$tagLine = AstNodeTest::getLine($tagNode);16$backgroundLine = AstNodeTest::getLine($backgroundNode);17$scenarioLine = AstNodeTest::getLine($scenarioNode);18$stepLine = AstNodeTest::getLine($stepNode);19$examplesLine = AstNodeTest::getLine($examplesNode);20$tableLine = AstNodeTest::getLine($tableNode);21echo $tagLine;22echo $backgroundLine;23echo $scenarioLine;24echo $stepLine;25echo $examplesLine;26echo $tableLine;

Full Screen

Full Screen

AstNodeTest

Using AI Code Generation

copy

Full Screen

1$astNodeTest = new AstNodeTest();2$astNodeTest->isNodeOfType("Given", "Given");3$astNodeTest = new AstNodeTest();4$astNodeTest->isNodeOfType("Given", "Given");5$astNodeTest = new AstNodeTest();6$astNodeTest->isNodeOfType("Given", "Given");7$astNodeTest = new AstNodeTest();8$astNodeTest->isNodeOfType("Given", "Given");9$astNodeTest = new AstNodeTest();10$astNodeTest->isNodeOfType("Given", "Given");11$astNodeTest = new AstNodeTest();12$astNodeTest->isNodeOfType("Given", "Given");13$astNodeTest = new AstNodeTest();14$astNodeTest->isNodeOfType("Given", "Given");15$astNodeTest = new AstNodeTest();16$astNodeTest->isNodeOfType("Given", "Given");17$astNodeTest = new AstNodeTest();18$astNodeTest->isNodeOfType("Given", "Given");19$astNodeTest = new AstNodeTest();20$astNodeTest->isNodeOfType("Given", "Given");21$astNodeTest = new AstNodeTest();22$astNodeTest->isNodeOfType("Given", "Given");

Full Screen

Full Screen

AstNodeTest

Using AI Code Generation

copy

Full Screen

1require_once 'AstNodeTest.php';2$astNodeTest = new AstNodeTest();3$featureFileContents = file_get_contents('2.feature');4$ast = $astNodeTest->getAst($featureFileContents);5$steps = $astNodeTest->getSteps($ast);6print_r($steps);7 (8 (9 (10 (11 (12 (13The getSteps() method of AstNodeTest class returns an array of steps present in the feature file. The array returned contains the following information about each step:14The getTags() method of AstNodeTest class returns an array of tags present in the feature file. The array returned contains the following information about each tag:

Full Screen

Full Screen

AstNodeTest

Using AI Code Generation

copy

Full Screen

1require_once 'CucumberCommon/AstNodeTest.php';2$test = new AstNodeTest();3$test->setNodeName('Feature');4$test->setNodeValue('Test Feature');5$test->setNodeAttribute('name', 'Test Feature');6$test->setNodeAttribute('description', 'This is a test feature');7$test->setNodeName('Scenario');8$test->setNodeValue('Test Scenario');9$test->setNodeAttribute('name', 'Test Scenario');10$test->setNodeName('Given');11$test->setNodeValue('I am on the home page');12$test->setNodeAttribute('name', 'I am on the home page');13$test->setNodeName('When');14$test->setNodeValue('I enter a search term');15$test->setNodeAttribute('name', 'I enter a search term');16$test->setNodeName('Then');17$test->setNodeValue('I should see results');18$test->setNodeAttribute('name', 'I should see results');19$test->setNodeName('Scenario');20$test->setNodeValue('Test Scenario 2');21$test->setNodeAttribute('name', 'Test Scenario 2');22$test->setNodeName('Given');23$test->setNodeValue('I am on the home page');24$test->setNodeAttribute('name', 'I am on the home page');25$test->setNodeName('When');26$test->setNodeValue('I enter a search term');27$test->setNodeAttribute('name', 'I enter a search term');28$test->setNodeName('Then');29$test->setNodeValue('I should see results');30$test->setNodeAttribute('name', 'I should see results');31$test->setNodeName('Scenario');32$test->setNodeValue('Test Scenario 3');33$test->setNodeAttribute('name', 'Test Scenario 3');34$test->setNodeName('Given');35$test->setNodeValue('I am on the home page');36$test->setNodeAttribute('name', 'I am on the home page');37$test->setNodeName('When');38$test->setNodeValue('I enter a search term');39$test->setNodeAttribute('name', 'I enter a search term');40$test->setNodeName('Then');41$test->setNodeValue('I should see results');

Full Screen

Full Screen

AstNodeTest

Using AI Code Generation

copy

Full Screen

1require_once('AstNodeTest.php');2$astNodeTest = new AstNodeTest();3$astNodeTest->generateAstNodes('1.php');4$astNodeTest->writeAstNodes('astNodes.txt');5require_once('AstNodeTest.php');6$astNodeTest = new AstNodeTest();7$astNodeTest->generateAstNodes('1.php');8$astNodeTest->writeAstNodes('astNodes.txt');9require_once('AstNodeTest.php');10$astNodeTest = new AstNodeTest();11$astNodeTest->generateAstNodes('1.php');12$astNodeTest->writeAstNodes('astNodes.txt');13require_once('AstNodeTest.php');14$astNodeTest = new AstNodeTest();15$astNodeTest->generateAstNodes('1.php');

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Cucumber Common Library automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Run Selenium Automation Tests on LambdaTest Cloud Grid

Trigger Selenium automation tests on a cloud-based Grid of 3000+ real browsers and operating systems.

Test now for Free

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful