Laravel version update

Laravel version update
This commit is contained in:
Manish Verma
2018-08-06 18:48:58 +05:30
parent d143048413
commit 126fbb0255
13678 changed files with 1031482 additions and 778530 deletions

View File

@@ -0,0 +1,36 @@
<?php declare(strict_types=1);
namespace PhpParser\Node\Stmt;
use PHPUnit\Framework\TestCase;
class ClassConstTest extends TestCase
{
/**
* @dataProvider provideModifiers
*/
public function testModifiers($modifier) {
$node = new ClassConst(
[], // invalid
constant('PhpParser\Node\Stmt\Class_::MODIFIER_' . strtoupper($modifier))
);
$this->assertTrue($node->{'is' . $modifier}());
}
public function testNoModifiers() {
$node = new ClassConst([], 0);
$this->assertTrue($node->isPublic());
$this->assertFalse($node->isProtected());
$this->assertFalse($node->isPrivate());
}
public function provideModifiers() {
return [
['public'],
['protected'],
['private'],
];
}
}

View File

@@ -1,22 +1,27 @@
<?php
<?php declare(strict_types=1);
namespace PhpParser\Node\Stmt;
class ClassMethodTest extends \PHPUnit_Framework_TestCase
use PhpParser\Node\Expr\Variable;
use PhpParser\Node\Name;
use PhpParser\Node\Param;
use PHPUnit\Framework\TestCase;
class ClassMethodTest extends TestCase
{
/**
* @dataProvider provideModifiers
*/
public function testModifiers($modifier) {
$node = new ClassMethod('foo', array(
$node = new ClassMethod('foo', [
'type' => constant('PhpParser\Node\Stmt\Class_::MODIFIER_' . strtoupper($modifier))
));
]);
$this->assertTrue($node->{'is' . $modifier}());
}
public function testNoModifiers() {
$node = new ClassMethod('foo', array('type' => 0));
$node = new ClassMethod('foo', ['type' => 0]);
$this->assertTrue($node->isPublic());
$this->assertFalse($node->isProtected());
@@ -24,17 +29,18 @@ class ClassMethodTest extends \PHPUnit_Framework_TestCase
$this->assertFalse($node->isAbstract());
$this->assertFalse($node->isFinal());
$this->assertFalse($node->isStatic());
$this->assertFalse($node->isMagic());
}
public function provideModifiers() {
return array(
array('public'),
array('protected'),
array('private'),
array('abstract'),
array('final'),
array('static'),
);
return [
['public'],
['protected'],
['private'],
['abstract'],
['final'],
['static'],
];
}
/**
@@ -42,22 +48,77 @@ class ClassMethodTest extends \PHPUnit_Framework_TestCase
*
* @dataProvider implicitPublicModifiers
*
* @param integer $modifier Node type modifier
* @param string $modifier Node type modifier
*/
public function testImplicitPublic($modifier)
public function testImplicitPublic(string $modifier)
{
$node = new ClassMethod('foo', array(
$node = new ClassMethod('foo', [
'type' => constant('PhpParser\Node\Stmt\Class_::MODIFIER_' . strtoupper($modifier))
));
]);
$this->assertTrue($node->isPublic(), 'Node should be implicitly public');
}
public function implicitPublicModifiers() {
return array(
array('abstract'),
array('final'),
array('static'),
);
return [
['abstract'],
['final'],
['static'],
];
}
/**
* @dataProvider provideMagics
*
* @param string $name Node name
*/
public function testMagic(string $name) {
$node = new ClassMethod($name);
$this->assertTrue($node->isMagic(), 'Method should be magic');
}
public function provideMagics() {
return [
['__construct'],
['__DESTRUCT'],
['__caLL'],
['__callstatic'],
['__get'],
['__set'],
['__isset'],
['__unset'],
['__sleep'],
['__wakeup'],
['__tostring'],
['__set_state'],
['__clone'],
['__invoke'],
['__debuginfo'],
];
}
public function testFunctionLike() {
$param = new Param(new Variable('a'));
$type = new Name('Foo');
$return = new Return_(new Variable('a'));
$method = new ClassMethod('test', [
'byRef' => false,
'params' => [$param],
'returnType' => $type,
'stmts' => [$return],
]);
$this->assertFalse($method->returnsByRef());
$this->assertSame([$param], $method->getParams());
$this->assertSame($type, $method->getReturnType());
$this->assertSame([$return], $method->getStmts());
$method = new ClassMethod('test', [
'byRef' => true,
'stmts' => null,
]);
$this->assertTrue($method->returnsByRef());
$this->assertNull($method->getStmts());
}
}

View File

@@ -1,11 +1,13 @@
<?php
<?php declare(strict_types=1);
namespace PhpParser\Node\Stmt;
class ClassTest extends \PHPUnit_Framework_TestCase
use PHPUnit\Framework\TestCase;
class ClassTest extends TestCase
{
public function testIsAbstract() {
$class = new Class_('Foo', array('type' => Class_::MODIFIER_ABSTRACT));
$class = new Class_('Foo', ['type' => Class_::MODIFIER_ABSTRACT]);
$this->assertTrue($class->isAbstract());
$class = new Class_('Foo');
@@ -13,7 +15,7 @@ class ClassTest extends \PHPUnit_Framework_TestCase
}
public function testIsFinal() {
$class = new Class_('Foo', array('type' => Class_::MODIFIER_FINAL));
$class = new Class_('Foo', ['type' => Class_::MODIFIER_FINAL]);
$this->assertTrue($class->isFinal());
$class = new Class_('Foo');
@@ -21,21 +23,21 @@ class ClassTest extends \PHPUnit_Framework_TestCase
}
public function testGetMethods() {
$methods = array(
$methods = [
new ClassMethod('foo'),
new ClassMethod('bar'),
new ClassMethod('fooBar'),
);
$class = new Class_('Foo', array(
'stmts' => array(
new TraitUse(array()),
];
$class = new Class_('Foo', [
'stmts' => [
new TraitUse([]),
$methods[0],
new ClassConst(array()),
new ClassConst([]),
$methods[1],
new Property(0, array()),
new Property(0, []),
$methods[2],
)
));
]
]);
$this->assertSame($methods, $class->getMethods());
}
@@ -43,14 +45,14 @@ class ClassTest extends \PHPUnit_Framework_TestCase
public function testGetMethod() {
$methodConstruct = new ClassMethod('__CONSTRUCT');
$methodTest = new ClassMethod('test');
$class = new Class_('Foo', array(
'stmts' => array(
new ClassConst(array()),
$class = new Class_('Foo', [
'stmts' => [
new ClassConst([]),
$methodConstruct,
new Property(0, array()),
new Property(0, []),
$methodTest,
)
));
]
]);
$this->assertSame($methodConstruct, $class->getMethod('__construct'));
$this->assertSame($methodTest, $class->getMethod('test'));

View File

@@ -1,25 +1,26 @@
<?php
<?php declare(strict_types=1);
namespace PhpParser\Node\Stmt;
use PhpParser\Node;
use PHPUnit\Framework\TestCase;
class InterfaceTest extends \PHPUnit_Framework_TestCase
class InterfaceTest extends TestCase
{
public function testGetMethods() {
$methods = array(
$methods = [
new ClassMethod('foo'),
new ClassMethod('bar'),
);
$interface = new Class_('Foo', array(
'stmts' => array(
new Node\Stmt\ClassConst(array(new Node\Const_('C1', new Node\Scalar\String_('C1')))),
];
$interface = new Class_('Foo', [
'stmts' => [
new Node\Stmt\ClassConst([new Node\Const_('C1', new Node\Scalar\String_('C1'))]),
$methods[0],
new Node\Stmt\ClassConst(array(new Node\Const_('C2', new Node\Scalar\String_('C2')))),
new Node\Stmt\ClassConst([new Node\Const_('C2', new Node\Scalar\String_('C2'))]),
$methods[1],
new Node\Stmt\ClassConst(array(new Node\Const_('C3', new Node\Scalar\String_('C3')))),
)
));
new Node\Stmt\ClassConst([new Node\Const_('C3', new Node\Scalar\String_('C3'))]),
]
]);
$this->assertSame($methods, $interface->getMethods());
}

View File

@@ -1,8 +1,10 @@
<?php
<?php declare(strict_types=1);
namespace PhpParser\Node\Stmt;
class PropertyTest extends \PHPUnit_Framework_TestCase
use PHPUnit\Framework\TestCase;
class PropertyTest extends TestCase
{
/**
* @dataProvider provideModifiers
@@ -10,14 +12,14 @@ class PropertyTest extends \PHPUnit_Framework_TestCase
public function testModifiers($modifier) {
$node = new Property(
constant('PhpParser\Node\Stmt\Class_::MODIFIER_' . strtoupper($modifier)),
array() // invalid
[] // invalid
);
$this->assertTrue($node->{'is' . $modifier}());
}
public function testNoModifiers() {
$node = new Property(0, array());
$node = new Property(0, []);
$this->assertTrue($node->isPublic());
$this->assertFalse($node->isProtected());
@@ -26,7 +28,7 @@ class PropertyTest extends \PHPUnit_Framework_TestCase
}
public function testStaticImplicitlyPublic() {
$node = new Property(Class_::MODIFIER_STATIC, array());
$node = new Property(Class_::MODIFIER_STATIC, []);
$this->assertTrue($node->isPublic());
$this->assertFalse($node->isProtected());
$this->assertFalse($node->isPrivate());
@@ -34,11 +36,11 @@ class PropertyTest extends \PHPUnit_Framework_TestCase
}
public function provideModifiers() {
return array(
array('public'),
array('protected'),
array('private'),
array('static'),
);
return [
['public'],
['protected'],
['private'],
['static'],
];
}
}