Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
/.idea/
/.project
/.webprj
/bin/
/composer.lock
/nbproject
/vendor/
/web/
89 changes: 89 additions & 0 deletions Tests/Integration/Composer/ScriptsTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
<?php
declare(strict_types=1);

namespace PhpList\RestBundle\Tests\Integration\Composer;

use PHPUnit\Framework\TestCase;

/**
* Testcase.
*
* @author Oliver Klee <[email protected]>
*/
class ScriptsTest extends TestCase
{
/**
* @test
*/
public function webDirectoryHasBeenCreated()
{
self::assertDirectoryExists($this->getAbsoluteWebDirectoryPath());
}

/**
* @return string
*/
private function getAbsoluteWebDirectoryPath(): string
{
return dirname(__DIR__, 3) . '/web/';
}

/**
* @return string[][]
*/
public function webDirectoryFilesDataProvider(): array
{
return [
'production entry point' => ['app.php'],
'development entry point' => ['app_dev.php'],
'testing entry point' => ['app_test.php'],
'.htaccess' => ['.htaccess'],
];
}

/**
* @test
* @param string $fileName
* @dataProvider webDirectoryFilesDataProvider
*/
public function webDirectoryFilesExist(string $fileName)
{
self::assertFileExists($this->getAbsoluteWebDirectoryPath() . $fileName);
}

/**
* @test
*/
public function binariesDirectoryHasBeenCreated()
{
self::assertDirectoryExists($this->getAbsoluteBinariesDirectoryPath());
}

/**
* @return string
*/
private function getAbsoluteBinariesDirectoryPath(): string
{
return dirname(__DIR__, 3) . '/bin/';
}

/**
* @return string[][]
*/
public function binariesDataProvider(): array
{
return [
'Symfony console' => ['console'],
];
}

/**
* @test
* @param string $fileName
* @dataProvider binariesDataProvider
*/
public function binariesExist(string $fileName)
{
self::assertFileExists($this->getAbsoluteBinariesDirectoryPath() . $fileName);
}
}
16 changes: 16 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,22 @@
"PhpList\\RestBundle\\Tests\\": "Tests/"
}
},
"scripts": {
"binaries": [
"PhpList\\PhpList4\\Composer\\ScriptHandler::createBinaries"
],
"document-root": [
"PhpList\\PhpList4\\Composer\\ScriptHandler::createPublicWebDirectory"
],
"post-install-cmd": [
"@binaries",
"@document-root"
],
"post-update-cmd": [
"@binaries",
"@document-root"
]
},
"extra": {
"branch-alias": {
"dev-master": "4.0.x-dev"
Expand Down