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

@@ -1,6 +1,6 @@
<?php
/*
* This file is part of the PHP_TokenStream package.
* This file is part of php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
@@ -8,33 +8,29 @@
* file that was distributed with this source code.
*/
/**
* Tests for the PHP_Token_INTERFACE class.
*
* @package PHP_TokenStream
* @subpackage Tests
* @author Sebastian Bergmann <sebastian@phpunit.de>
* @author Laurent Laville <pear@laurent-laville.org>
* @copyright Sebastian Bergmann <sebastian@phpunit.de>
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
* @version Release: @package_version@
* @link http://github.com/sebastianbergmann/php-token-stream/
* @since Class available since Release 1.0.0
*/
class PHP_Token_InterfaceTest extends PHPUnit_Framework_TestCase
use PHPUnit\Framework\TestCase;
class PHP_Token_InterfaceTest extends TestCase
{
protected $class;
protected $interfaces;
/**
* @var PHP_Token_CLASS
*/
private $class;
/**
* @var PHP_Token_INTERFACE[]
*/
private $interfaces;
protected function setUp()
{
$ts = new PHP_Token_Stream(TEST_FILES_PATH . 'source4.php');
$i = 0;
foreach ($ts as $token) {
if ($token instanceof PHP_Token_CLASS) {
$this->class = $token;
}
elseif ($token instanceof PHP_Token_INTERFACE) {
} elseif ($token instanceof PHP_Token_INTERFACE) {
$this->interfaces[$i] = $token;
$i++;
}
@@ -97,7 +93,7 @@ class PHP_Token_InterfaceTest extends PHPUnit_Framework_TestCase
public function testGetInterfacesExists()
{
$this->assertEquals(
array('b'),
['b'],
$this->class->getInterfaces()
);
}
@@ -111,13 +107,15 @@ class PHP_Token_InterfaceTest extends PHPUnit_Framework_TestCase
$this->class->hasInterfaces()
);
}
/**
* @covers PHP_Token_INTERFACE::getPackage
*/
public function testGetPackageNamespace() {
public function testGetPackageNamespace()
{
$tokenStream = new PHP_Token_Stream(TEST_FILES_PATH . 'classInNamespace.php');
foreach($tokenStream as $token) {
if($token instanceOf PHP_Token_INTERFACE) {
foreach ($tokenStream as $token) {
if ($token instanceof PHP_Token_INTERFACE) {
$package = $token->getPackage();
$this->assertSame('Foo\\Bar', $package['namespace']);
}
@@ -125,22 +123,24 @@ class PHP_Token_InterfaceTest extends PHPUnit_Framework_TestCase
}
public function provideFilesWithClassesWithinMultipleNamespaces() {
return array(
array(TEST_FILES_PATH . 'multipleNamespacesWithOneClassUsingBraces.php'),
array(TEST_FILES_PATH . 'multipleNamespacesWithOneClassUsingNonBraceSyntax.php'),
);
public function provideFilesWithClassesWithinMultipleNamespaces()
{
return [
[TEST_FILES_PATH . 'multipleNamespacesWithOneClassUsingBraces.php'],
[TEST_FILES_PATH . 'multipleNamespacesWithOneClassUsingNonBraceSyntax.php'],
];
}
/**
* @dataProvider provideFilesWithClassesWithinMultipleNamespaces
* @covers PHP_Token_INTERFACE::getPackage
*/
public function testGetPackageNamespaceForFileWithMultipleNamespaces($filepath) {
$tokenStream = new PHP_Token_Stream($filepath);
public function testGetPackageNamespaceForFileWithMultipleNamespaces($filepath)
{
$tokenStream = new PHP_Token_Stream($filepath);
$firstClassFound = false;
foreach($tokenStream as $token) {
if($firstClassFound === false && $token instanceOf PHP_Token_INTERFACE) {
foreach ($tokenStream as $token) {
if ($firstClassFound === false && $token instanceof PHP_Token_INTERFACE) {
$package = $token->getPackage();
$this->assertSame('TestClassInBar', $token->getName());
$this->assertSame('Foo\\Bar', $package['namespace']);
@@ -148,44 +148,48 @@ class PHP_Token_InterfaceTest extends PHPUnit_Framework_TestCase
continue;
}
// Secound class
if($token instanceOf PHP_Token_INTERFACE) {
if ($token instanceof PHP_Token_INTERFACE) {
$package = $token->getPackage();
$this->assertSame('TestClassInBaz', $token->getName());
$this->assertSame('Foo\\Baz', $package['namespace']);
return;
}
}
$this->fail("Seachring for 2 classes failed");
$this->fail('Seachring for 2 classes failed');
}
public function testGetPackageNamespaceIsEmptyForInterfacesThatAreNotWithinNamespaces() {
foreach($this->interfaces as $token) {
public function testGetPackageNamespaceIsEmptyForInterfacesThatAreNotWithinNamespaces()
{
foreach ($this->interfaces as $token) {
$package = $token->getPackage();
$this->assertSame("", $package['namespace']);
$this->assertSame('', $package['namespace']);
}
}
/**
* @covers PHP_Token_INTERFACE::getPackage
*/
public function testGetPackageNamespaceWhenExtentingFromNamespaceClass() {
$tokenStream = new PHP_Token_Stream(TEST_FILES_PATH . 'classExtendsNamespacedClass.php');
public function testGetPackageNamespaceWhenExtentingFromNamespaceClass()
{
$tokenStream = new PHP_Token_Stream(TEST_FILES_PATH . 'classExtendsNamespacedClass.php');
$firstClassFound = false;
foreach($tokenStream as $token) {
if($firstClassFound === false && $token instanceOf PHP_Token_INTERFACE) {
foreach ($tokenStream as $token) {
if ($firstClassFound === false && $token instanceof PHP_Token_INTERFACE) {
$package = $token->getPackage();
$this->assertSame('Baz', $token->getName());
$this->assertSame('Foo\\Bar', $package['namespace']);
$firstClassFound = true;
continue;
}
if($token instanceOf PHP_Token_INTERFACE) {
if ($token instanceof PHP_Token_INTERFACE) {
$package = $token->getPackage();
$this->assertSame('Extender', $token->getName());
$this->assertSame('Other\\Space', $package['namespace']);
return;
}
}
$this->fail("Searching for 2 classes failed");
$this->fail('Searching for 2 classes failed');
}
}