for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace SlayerBirden\DFCodeGeneration\Writer;
use PHPUnit\Framework\TestCase;
class Psr4FileNameProviderTest extends TestCase
{
/**
* @dataProvider fileContentsProvider
*
* @param $contents
* @param $expectedFileName
*/
public function testGetFileName($contents, $expectedFileName)
$provider = new Psr4FileNameProvider();
$this->assertEquals($expectedFileName, $provider->getFileName($contents));
}
public function fileContentsProvider(): array
$body1 = <<<'BODY'
namespace Foo\Bar\Dummy\Controller;
class AddAction {}
BODY;
$body2 = <<<'BODY'
namespace Foo\Bar\Dummy;
class ConfigProvider {}
$body3 = <<<'BODY'
namespace Foo\Bar\Baz;
class Dummy {}
$body4 = <<<'BODY'
class DummyCest {}
$body5 = <<<'BODY'
class GetDummiesCest {}
$body6 = <<<'BODY'
class AwesomeDummiesCest {}
$body7 = <<<'BODY'
class GetBusesCest {}
return [
[$body1, 'src/Dummy/Controller/AddAction.php'],
[$body2, 'src/Dummy/ConfigProvider.php'],
[$body3, 'src/Baz/Dummy.php'],
[$body4, 'tests/api/dummy/DummyCest.php'],
[$body5, 'tests/api/dummy/GetDummiesCest.php'],
[$body6, 'tests/api/awesomedummy/AwesomeDummiesCest.php'],
[$body7, 'tests/api/bus/GetBusesCest.php'],
];