the whole shebang
This commit is contained in:
35
vendor/nikic/php-parser/test/PHPParser/Tests/Node/Stmt/ClassMethodTest.php
vendored
Normal file
35
vendor/nikic/php-parser/test/PHPParser/Tests/Node/Stmt/ClassMethodTest.php
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
class PHPParser_Tests_Node_Stmt_ClassMethodTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider provideModifiers
|
||||
*/
|
||||
public function testModifiers($modifier) {
|
||||
$node = new PHPParser_Node_Stmt_ClassMethod('foo', array(
|
||||
'type' => constant('PHPParser_Node_Stmt_Class::MODIFIER_' . strtoupper($modifier))
|
||||
));
|
||||
|
||||
$this->assertTrue($node->{'is' . $modifier}());
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideModifiers
|
||||
*/
|
||||
public function testNoModifiers($modifier) {
|
||||
$node = new PHPParser_Node_Stmt_ClassMethod('foo', array('type' => 0));
|
||||
|
||||
$this->assertFalse($node->{'is' . $modifier}());
|
||||
}
|
||||
|
||||
public function provideModifiers() {
|
||||
return array(
|
||||
array('public'),
|
||||
array('protected'),
|
||||
array('private'),
|
||||
array('abstract'),
|
||||
array('final'),
|
||||
array('static'),
|
||||
);
|
||||
}
|
||||
}
|
40
vendor/nikic/php-parser/test/PHPParser/Tests/Node/Stmt/ClassTest.php
vendored
Normal file
40
vendor/nikic/php-parser/test/PHPParser/Tests/Node/Stmt/ClassTest.php
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
class PHPParser_Tests_Node_Stmt_ClassTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testIsAbstract() {
|
||||
$class = new PHPParser_Node_Stmt_Class('Foo', array('type' => PHPParser_Node_Stmt_Class::MODIFIER_ABSTRACT));
|
||||
$this->assertTrue($class->isAbstract());
|
||||
|
||||
$class = new PHPParser_Node_Stmt_Class('Foo');
|
||||
$this->assertFalse($class->isAbstract());
|
||||
}
|
||||
|
||||
public function testIsFinal() {
|
||||
$class = new PHPParser_Node_Stmt_Class('Foo', array('type' => PHPParser_Node_Stmt_Class::MODIFIER_FINAL));
|
||||
$this->assertTrue($class->isFinal());
|
||||
|
||||
$class = new PHPParser_Node_Stmt_Class('Foo');
|
||||
$this->assertFalse($class->isFinal());
|
||||
}
|
||||
|
||||
public function testGetMethods() {
|
||||
$methods = array(
|
||||
new PHPParser_Node_Stmt_ClassMethod('foo'),
|
||||
new PHPParser_Node_Stmt_ClassMethod('bar'),
|
||||
new PHPParser_Node_Stmt_ClassMethod('fooBar'),
|
||||
);
|
||||
$class = new PHPParser_Node_Stmt_Class('Foo', array(
|
||||
'stmts' => array(
|
||||
new PHPParser_Node_Stmt_TraitUse(array()),
|
||||
$methods[0],
|
||||
new PHPParser_Node_Stmt_Const(array()),
|
||||
$methods[1],
|
||||
new PHPParser_Node_Stmt_Property(0, array()),
|
||||
$methods[2],
|
||||
)
|
||||
));
|
||||
|
||||
$this->assertEquals($methods, $class->getMethods());
|
||||
}
|
||||
}
|
34
vendor/nikic/php-parser/test/PHPParser/Tests/Node/Stmt/PropertyTest.php
vendored
Normal file
34
vendor/nikic/php-parser/test/PHPParser/Tests/Node/Stmt/PropertyTest.php
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
class PHPParser_Tests_Node_Stmt_PropertyTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider provideModifiers
|
||||
*/
|
||||
public function testModifiers($modifier) {
|
||||
$node = new PHPParser_Node_Stmt_Property(
|
||||
constant('PHPParser_Node_Stmt_Class::MODIFIER_' . strtoupper($modifier)),
|
||||
array() // invalid
|
||||
);
|
||||
|
||||
$this->assertTrue($node->{'is' . $modifier}());
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideModifiers
|
||||
*/
|
||||
public function testNoModifiers($modifier) {
|
||||
$node = new PHPParser_Node_Stmt_Property(0, array());
|
||||
|
||||
$this->assertFalse($node->{'is' . $modifier}());
|
||||
}
|
||||
|
||||
public function provideModifiers() {
|
||||
return array(
|
||||
array('public'),
|
||||
array('protected'),
|
||||
array('private'),
|
||||
array('static'),
|
||||
);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user