Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
No results found
Show changes
Showing
with 797 additions and 1 deletion
<?xml version="1.0"?>
<ruleset name="CustomStandard">
</ruleset>
<?xml version="1.0"?>
<ruleset name="">
</ruleset>
<?php
namespace Higidi\ComposerPhpCSStandardsPlugin\Tests\Integration\PHPCodeSniffer\Standard;
/*
* Copyright (C) 2017 Daniel Hürtgen <daniel@higidi.de>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/
use Higidi\ComposerPhpCSStandardsPlugin\PHPCodeSniffer\Finder;
use Higidi\ComposerPhpCSStandardsPlugin\PHPCodeSniffer\Standards\Factory;
use PHPUnit\Framework\TestCase;
/**
* Integration test case for class \Higidi\ComposerPhpCSStandardsPlugin\PHPCodeSniffer\Finder
*/
class FinderTest extends TestCase
{
/**
* @var Finder
*/
protected $fixture;
/**
* @var Factory|\PHPUnit_Framework_MockObject_MockObject
*/
protected $standardsFactoryMock;
protected function setUp()
{
parent::setUp();
$this->standardsFactoryMock = $this->getMockBuilder(
'Higidi\ComposerPhpCSStandardsPlugin\PHPCodeSniffer\Standards\Factory'
)
->disableOriginalConstructor()
->getMock();
$this->fixture = new Finder(null, $this->standardsFactoryMock);
}
protected function tearDown()
{
parent::tearDown();
unset($this->fixture);
unset($this->standardsFactoryMock);
}
public function testFinder()
{
$path = realpath(implode(DIRECTORY_SEPARATOR, [__DIR__, '..', '..', 'Fixtures', 'Standards']));
$expected = [
$path . DIRECTORY_SEPARATOR . 'Standard1',
$path . DIRECTORY_SEPARATOR . 'Standard2',
$path . DIRECTORY_SEPARATOR . 'Standard3',
$path . DIRECTORY_SEPARATOR . 'standard_with_ruleset',
$path . DIRECTORY_SEPARATOR . 'standard_with_ruleset_without_name',
];
$this->standardsFactoryMock
->expects($this->once())
->method('create')
->with($expected);
$this->fixture->in($path);
}
}
<?php
namespace Higidi\ComposerPhpCSStandardsPlugin\Tests\Unit\PHPCodeSniffer\Standards\Standard;
/*
* Copyright (C) 2017 Daniel Hürtgen <daniel@higidi.de>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/
use Higidi\ComposerPhpCSStandardsPlugin\PHPCodeSniffer\Finder;
use Higidi\ComposerPhpCSStandardsPlugin\PHPCodeSniffer\Standards\Factory;
use Higidi\ComposerPhpCSStandardsPlugin\Symfony\Finder\Factory as SymfonyFinderFactory;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Finder\Finder as SymfonyFinder;
/**
* Test case for class \Higidi\ComposerPhpCSStandardsPlugin\PHPCodeSniffer\Finder
*
* @covers \Higidi\ComposerPhpCSStandardsPlugin\PHPCodeSniffer\Finder
*/
class FinderTest extends TestCase
{
/**
* @var Finder
*/
protected $classUnderTesting;
/**
* @var SymfonyFinderFactory|\PHPUnit_Framework_MockObject_MockObject
*/
protected $symfonyFinderFactoryMock;
/**
* @var SymfonyFinder|\PHPUnit_Framework_MockObject_MockObject
*/
protected $symfonyFinderMock;
/**
* @var Factory|\PHPUnit_Framework_MockObject_MockObject
*/
protected $standardsFactoryMock;
protected function setUp()
{
parent::setUp();
$this->symfonyFinderFactoryMock = $this->getMockBuilder(
'Higidi\ComposerPhpCSStandardsPlugin\Symfony\Finder\Factory'
)->getMock();
$this->symfonyFinderMock = $this->getMockBuilder('Symfony\Component\Finder\Finder')->getMock();
$this->symfonyFinderFactoryMock
->method('create')
->willReturn($this->symfonyFinderMock);
$this->standardsFactoryMock = $this->getMockBuilder(
'Higidi\ComposerPhpCSStandardsPlugin\PHPCodeSniffer\Standards\Factory'
)
->disableOriginalConstructor()
->getMock();
$this->classUnderTesting = new Finder($this->symfonyFinderFactoryMock, $this->standardsFactoryMock);
}
protected function tearDown()
{
parent::tearDown();
unset($this->classUnderTesting);
unset($this->standardsFactoryMock);
}
public function testFinder()
{
$path = realpath(implode(DIRECTORY_SEPARATOR, [__DIR__, '..', '..', '..', 'Fixtures', 'Standards']));
$expected = [
$path . DIRECTORY_SEPARATOR . 'Standard1',
];
foreach (['in', 'files', 'name', 'sortByName'] as $fluentMethod) {
$this->symfonyFinderMock
->method($fluentMethod)
->willReturn($this->symfonyFinderMock);
}
$splFileInfoMock = $this->getMockBuilder('Symfony\Component\Finder\SplFileInfo')
->setConstructorArgs([null, null, null])
->getMock();
$splFileInfoMock
->expects($this->once())
->method('getPath')
->willReturn($path . DIRECTORY_SEPARATOR . 'Standard1');
$finderIterator = new \ArrayIterator(
[
$splFileInfoMock,
]
);
$this->symfonyFinderMock
->expects($this->once())
->method('getIterator')
->willReturn($finderIterator);
$this->standardsFactoryMock
->expects($this->once())
->method('create')
->with($expected);
$this->classUnderTesting->in($path);
}
}
<?php
namespace Higidi\ComposerPhpCSStandardsPlugin\Tests\Unit\PHPCodeSniffer\Standards;
/*
* Copyright (C) 2017 Daniel Hürtgen <daniel@higidi.de>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/
use Higidi\ComposerPhpCSStandardsPlugin\PHPCodeSniffer\Standards\Factory;
use Higidi\ComposerPhpCSStandardsPlugin\PHPCodeSniffer\Standards\Standard\Factory as StandardFactory;
use PHPUnit\Framework\TestCase;
/**
* Test case for class \Higidi\ComposerPhpCSStandardsPlugin\PHPCodeSniffer\Standards\Factory
*
* @covers \Higidi\ComposerPhpCSStandardsPlugin\PHPCodeSniffer\Standards\Factory
*/
class FactoryTest extends TestCase
{
/**
* @var Factory
*/
protected $classUnderTesting;
/**
* @var StandardFactory|\PHPUnit_Framework_MockObject_MockObject
*/
protected $standardFactoryMock;
protected function setUp()
{
parent::setUp();
$this->standardFactoryMock = $this->getMockBuilder(
'Higidi\ComposerPhpCSStandardsPlugin\PHPCodeSniffer\Standards\Standard\Factory'
)->getMock();
$this->standardFactoryMock
->method('create')
->willReturn(
$this->getMockBuilder('Higidi\ComposerPhpCSStandardsPlugin\PHPCodeSniffer\Standards\Standard\Standard')
->disableOriginalConstructor()
->getMock()
);
$this->classUnderTesting = new Factory($this->standardFactoryMock);
}
protected function tearDown()
{
parent::tearDown();
unset($this->standardFactoryMock);
unset($this->classUnderTesting);
}
public function testCreateStandard()
{
$paths = [];
$paths[] = implode(
DIRECTORY_SEPARATOR,
[__DIR__, '..', '..', '..', '..', 'Fixtures', 'Standards', 'Standard1']
);
$this->standardFactoryMock
->expects($this->exactly(count($paths)))
->method('create')
->withConsecutive($paths);
$standards = $this->classUnderTesting->create($paths);
$this->assertInstanceOf('Higidi\ComposerPhpCSStandardsPlugin\PHPCodeSniffer\Standards\Standards', $standards);
}
}
<?php
namespace Higidi\ComposerPhpCSStandardsPlugin\Tests\Unit\PHPCodeSniffer\Standards\Standard;
/*
* Copyright (C) 2017 Daniel Hürtgen <daniel@higidi.de>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/
use Higidi\ComposerPhpCSStandardsPlugin\PHPCodeSniffer\Standards\Standard\Factory;
use PHPUnit\Framework\TestCase;
/**
* Test case for class \Higidi\ComposerPhpCSStandardsPlugin\PHPCodeSniffer\Standards\Standard\Factory
*
* @covers \Higidi\ComposerPhpCSStandardsPlugin\PHPCodeSniffer\Standards\Standard\Factory
*/
class FactoryTest extends TestCase
{
/**
* @var Factory
*/
protected $classUnderTesting;
protected function setUp()
{
parent::setUp();
$this->classUnderTesting = new Factory();
}
protected function tearDown()
{
parent::tearDown();
unset($this->classUnderTesting);
}
public function testCreateStandard()
{
$path = implode(
DIRECTORY_SEPARATOR,
[__DIR__, '..', '..', '..', '..', 'Fixtures', 'Standards', 'Standard1']
);
$standard = $this->classUnderTesting->create($path);
$this->assertInstanceOf(
'Higidi\ComposerPhpCSStandardsPlugin\PHPCodeSniffer\Standards\Standard\Standard',
$standard
);
}
}
<?php
namespace Higidi\ComposerPhpCSStandardsPlugin\Tests\Unit\PHPCodeSniffer\Standards\Standard;
/*
* Copyright (C) 2017 Daniel Hürtgen <daniel@higidi.de>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/
use Higidi\ComposerPhpCSStandardsPlugin\PHPCodeSniffer\Standards\Standard\Standard;
use PHPUnit\Framework\TestCase;
/**
* Test case for class \Higidi\ComposerPhpCSStandardsPlugin\PHPCodeSniffer\Standards\Standard\Standard
*
* @covers \Higidi\ComposerPhpCSStandardsPlugin\PHPCodeSniffer\Standards\Standard\Standard
*/
class StandardTest extends TestCase
{
/**
* @dataProvider differentStandards
*
* @param string $standardName
* @param string $expectedName
*/
public function testStandard($standardName, $expectedName)
{
$path = implode(
DIRECTORY_SEPARATOR,
[__DIR__, '..', '..', '..', '..', 'Fixtures', 'Standards', $standardName]
);
$ruleSetXmlPath = $path . DIRECTORY_SEPARATOR . 'ruleset.xml';
$standard = new Standard($path);
$this->assertSame(
$expectedName,
$standard->getName(),
'The standard instance did not return the expected name.'
);
$this->assertSame(
realpath($path),
$standard->getPath(),
'The standard instance did not return the expected path value.'
);
$this->assertSame(
$ruleSetXmlPath,
$standard->getRuleSetXmlPath(),
'The standard instance did not return the expected ruleset.xml path value.'
);
}
public function differentStandards()
{
return [
'No Ruleset' => [
'Standard1',
'Standard1',
],
'Ruleset with name' => [
'standard_with_ruleset',
'CustomStandard',
],
'Ruleset without name' => [
'standard_with_ruleset_without_name',
'standard_with_ruleset_without_name',
],
];
}
/**
* @expectedException \Higidi\ComposerPhpCSStandardsPlugin\PHPCodeSniffer\Standards\Standard\Exception\StandardPathAccessDeniedException
*/
public function testIfStandardPathAccessDeniedExceptionIsThrown()
{
new Standard('foo');
}
/**
* @expectedException \Higidi\ComposerPhpCSStandardsPlugin\PHPCodeSniffer\Standards\Standard\Exception\InvalidStandardException
*/
public function testIfInvalidStandardExceptionIsThrown()
{
$path = implode(
DIRECTORY_SEPARATOR,
[__DIR__, '..', '..', '..', '..', 'Fixtures', 'Standards', 'InvalidStandard']
);
new Standard($path);
}
}
<?php
namespace Higidi\ComposerPhpCSStandardsPlugin\Tests\Unit\PHPCodeSniffer\Standards;
/*
* Copyright (C) 2017 Daniel Hürtgen <daniel@higidi.de>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/
use Higidi\ComposerPhpCSStandardsPlugin\PHPCodeSniffer\Standards\Standard\StandardInterface;
use Higidi\ComposerPhpCSStandardsPlugin\PHPCodeSniffer\Standards\Standards;
use PHPUnit\Framework\TestCase;
/**
* Test case for "\Higidi\ComposerPhpCSStandardsPlugin\PHPCodeSniffer\Standards\Standards".
*
* @covers \Higidi\ComposerPhpCSStandardsPlugin\PHPCodeSniffer\Standards\Standards
*/
class StandardsTest extends TestCase
{
/**
* @param string $name
*
* @return StandardInterface
*/
protected function createStandardMock($name)
{
$standard = $this->prophesize(
'\Higidi\ComposerPhpCSStandardsPlugin\PHPCodeSniffer\Standards\Standard\StandardInterface'
);
$standard
->getName()
->willReturn($name);
return $standard->reveal();
}
/**
* @test
*/
public function itImplementsTheIteratorInterface()
{
$sut = new Standards();
$this->assertInstanceOf('\Iterator', $sut);
}
/**
* @test
*/
public function itHasAnEmptyArrayAsDefaultStandards()
{
$sut = new Standards();
$standards = $sut->getStandards();
$this->assertInternalType('array', $standards);
$this->assertEmpty($standards);
}
/**
* @test
*/
public function itAcceptsStandardViaConstructor()
{
$standards = [
$this->createStandardMock('standard1'),
$this->createStandardMock('standard2'),
$this->createStandardMock('standard3'),
];
$sut = new Standards($standards);
$this->assertSame($standards, $sut->getStandards());
}
/**
* @test
*/
public function itHoldsStandards()
{
$standards = [
$this->createStandardMock('standard1'),
$this->createStandardMock('standard2'),
$this->createStandardMock('standard3'),
];
$sut = new Standards();
$sut->setStandards($standards);
$this->assertSame($standards, $sut->getStandards());
return $sut;
}
/**
* @test
* @depends itHoldsStandards
*
* @param Standards $sut
*/
public function itCanAddStandardsToTheSet(Standards $sut)
{
$standards = $sut->getStandards();
$newStandard = $this->createStandardMock('standard4');
$this->assertSame($standards, $sut->getStandards());
$sut->addStandard($newStandard);
$expectedStandards = array_merge($standards, [$newStandard]);
$this->assertSame($expectedStandards, $sut->getStandards());
}
/**
* @test
* @depends itHoldsStandards
*
* @param Standards $sut
*/
public function itCanRemoveStandardsFromTheSet(Standards $sut)
{
$standards = $sut->getStandards();
$removeableStandard = array_shift($standards);
$sut->removeStandard($removeableStandard);
$this->assertSame($standards, $sut->getStandards());
}
/**
* @return array
*/
public function differentStandardIdentifierTypesDataProvider()
{
$standardName = 'blafoo';
$standard = $this->createStandardMock($standardName);
return [
'as_string' => [$standard, $standardName],
'as_object' => [$standard, $standard],
];
}
/**
* @test
* @dataProvider differentStandardIdentifierTypesDataProvider
*
* @param StandardInterface $standard
* @param string|object $identifier
*/
public function itReturnsWhetherItHoldsAStandardOrNot(StandardInterface $standard, $identifier)
{
$sut = new Standards();
$this->assertFalse($sut->hasStandard($identifier));
$sut->addStandard($standard);
$this->assertTrue($sut->hasStandard($identifier));
}
/**
* @test
* @dataProvider differentStandardIdentifierTypesDataProvider
*
* @param StandardInterface $standard
* @param string|object $identifier
*/
public function itReturnsAStandardItHolds(StandardInterface $standard, $identifier)
{
$sut = new Standards();
$this->assertNull($sut->getStandard($identifier));
$sut->addStandard($standard);
$this->assertSame($standard, $sut->getStandard($identifier));
}
/**
* @test
*/
public function itIsIteratable()
{
$standards = [
$this->createStandardMock('standard1'),
$this->createStandardMock('standard2'),
$this->createStandardMock('standard3'),
];
$iteratedStandards = [];
$sut = new Standards($standards);
foreach ($sut as $key => $standard) {
$iteratedStandards[$key] = $standard;
}
$this->assertSame($standards, $iteratedStandards);
}
}
<?php
namespace Higidi\ComposerPhpCSStandardsPlugin\Tests\Unit;
/*
* Copyright (C) 2017 Daniel Hürtgen <daniel@higidi.de>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/
use Higidi\ComposerPhpCSStandardsPlugin\Plugin;
use PHPUnit\Framework\TestCase;
use Prophecy\Argument;
/**
* Test case for "\Higidi\ComposerPhpCSStandardsPlugin\Plugin".
*
* @covers \Higidi\ComposerPhpCSStandardsPlugin\Plugin
*/
class PluginTest extends TestCase
{
/**
* @test
*/
public function itImplementsThePluginInterface()
{
$sut = new Plugin();
$this->assertInstanceOf('\Composer\Plugin\PluginInterface', $sut);
}
/**
* @test
*/
public function itRegisteredThePhpCSStandardsInstallerToComposer()
{
$installationManager = $this->prophesize('\Composer\Installer\InstallationManager');
$installationManager
->addInstaller(Argument::type('\Higidi\ComposerPhpCSStandardsPlugin\Installer'))
->shouldBeCalled();
$downloadManager = $this->prophesize('\Composer\Downloader\DownloadManager');
$config = $this->prophesize('\Composer\Config');
$composer = $this->prophesize('\Composer\Composer');
$composer
->getInstallationManager()
->willReturn($installationManager->reveal());
$composer
->getDownloadManager()
->willReturn($downloadManager->reveal());
$composer
->getConfig()
->willReturn($config->reveal());
$io = $this->prophesize('\Composer\IO\IOInterface');
$sut = new Plugin();
$sut->activate($composer->reveal(), $io->reveal());
}
}
<?php
namespace Higidi\ComposerPhpCSStandardsPlugin\Tests\Unit\Symfony\Finder;
/*
* Copyright (C) 2017 Daniel Hürtgen <daniel@higidi.de>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/
use Higidi\ComposerPhpCSStandardsPlugin\Symfony\Finder\Factory;
use PHPUnit\Framework\TestCase;
/**
* Test case for class \Higidi\ComposerPhpCSStandardsPlugin\Symfony\Finder\Factory
*
* @covers \Higidi\ComposerPhpCSStandardsPlugin\Symfony\Finder\Factory
*/
class FactoryTest extends TestCase
{
public function testCreateFinder()
{
$factory = new Factory();
$finder = $factory->create();
$this->assertInstanceOf('Symfony\Component\Finder\Finder', $finder);
}
}
<?php
/*
* Copyright (C) 2017 Daniel Hürtgen <daniel@higidi.de>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/
error_reporting(E_ALL);
if (function_exists('date_default_timezone_set') && function_exists('date_default_timezone_get')) {
......@@ -11,7 +30,7 @@ function includeIfExists($file)
return file_exists($file) ? include $file : false;
}
if (!$autoLoader = includeIfExists(__DIR__ . '/../vendor/autoload.php')) {
if (! $autoLoader = includeIfExists(__DIR__ . '/../vendor/autoload.php')) {
echo 'You must set up the project dependencies, run the following command from the project root:' . PHP_EOL .
'php composer.phar install' . PHP_EOL;
exit(1);
......