Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUPH-92 | single line annotations #38

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions tests/v1/MultipleAPs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fab/*
11 changes: 11 additions & 0 deletions tests/v1/MultipleAPs/control/MultipleAnnotations.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php
declare(strict_types=1);

namespace Neighborhoods\BuphaloTest;

class MultipleAnnotations
{
public const TEST_STRING = '';

public const SECOND = 'second';
}
37 changes: 37 additions & 0 deletions tests/v1/MultipleAPs/run_test
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/usr/bin/env php
<?php
declare(strict_types=1);
error_reporting(E_ALL);

$PWD = __DIR__;

// Must load autoloader before including any Annotation Processors
if (file_exists($autoloaderFilePath = dirname($PWD, 5) . '/autoload.php')) {
/** @noinspection PhpIncludeInspection */
require_once $autoloaderFilePath;
} else if (file_exists($autoloaderFilePath = dirname($PWD, 3) . '/vendor/autoload.php')) {
/** @noinspection PhpIncludeInspection */
require_once $autoloaderFilePath;
} else {
throw new RuntimeException('Unable to find the Composer autoloader.');
}

// Include Annotation Processors for Buphalo
// None for this test

// Add exec envs
putenv("Neighborhoods_Buphalo_V1_TargetApplication_BuilderInterface__SourceDirectoryPath=$PWD/src");
putenv("Neighborhoods_Buphalo_V1_TargetApplication_BuilderInterface__FabricationDirectoryPath=$PWD/fab");
putenv("Neighborhoods_Buphalo_V1_TargetApplication_BuilderInterface__NamespacePrefix=Neighborhoods\\BuphaloTest");
putenv("Neighborhoods_Buphalo_V1_TemplateTree_Map_Builder_FactoryInterface__TemplateTreeDirectoryPaths=$PWD/templates");

// Include Buphalo
require_once($PWD . '/../../../bin/v1/buphalo.php');

// Diff the two directories
exec("diff -r $PWD/control/ $PWD/fab/", $output, $return);

if ($return) {
echo(implode(PHP_EOL, $output) . PHP_EOL);
die(1);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
actors:
<PrimaryActorName>.php:
template: PrimaryActorName.php
annotation_processors:
FirstAnnotation:
processor_fqcn: \Neighborhoods\Buphalo\V1\AnnotationProcessors\EmptyString
SecondAnnotation:
processor_fqcn: \Neighborhoods\Buphalo\V1\AnnotationProcessors\SimpleString
static_context_record:
string: "public const SECOND = 'second';"
13 changes: 13 additions & 0 deletions tests/v1/MultipleAPs/templates/PrimaryActorName.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php
declare(strict_types=1);

namespace Neighborhoods\BuphaloTemplateTree;

class PrimaryActorName
{
public const TEST_STRING = '/** @neighborhoods-buphalo:annotation-processor FirstAnnotation
*/';

/** @neighborhoods-buphalo:annotation-processor SecondAnnotation
*/
}
1 change: 1 addition & 0 deletions tests/v1/MultipleSingleLineAPs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fab/*
13 changes: 13 additions & 0 deletions tests/v1/MultipleSingleLineAPs/control/MultipleSingleLine.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php
declare(strict_types=1);

namespace Neighborhoods\BuphaloTest;

class MultipleSingleLine
{
public const TEST_STRING = '';

public const IN_BETWEEN = 'in_between';

public const SECOND = 'second';
}
37 changes: 37 additions & 0 deletions tests/v1/MultipleSingleLineAPs/run_test
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/usr/bin/env php
<?php
declare(strict_types=1);
error_reporting(E_ALL);

$PWD = __DIR__;

// Must load autoloader before including any Annotation Processors
if (file_exists($autoloaderFilePath = dirname($PWD, 5) . '/autoload.php')) {
/** @noinspection PhpIncludeInspection */
require_once $autoloaderFilePath;
} else if (file_exists($autoloaderFilePath = dirname($PWD, 3) . '/vendor/autoload.php')) {
/** @noinspection PhpIncludeInspection */
require_once $autoloaderFilePath;
} else {
throw new RuntimeException('Unable to find the Composer autoloader.');
}

// Include Annotation Processors for Buphalo
// None for this test

// Add exec envs
putenv("Neighborhoods_Buphalo_V1_TargetApplication_BuilderInterface__SourceDirectoryPath=$PWD/src");
putenv("Neighborhoods_Buphalo_V1_TargetApplication_BuilderInterface__FabricationDirectoryPath=$PWD/fab");
putenv("Neighborhoods_Buphalo_V1_TargetApplication_BuilderInterface__NamespacePrefix=Neighborhoods\\BuphaloTest");
putenv("Neighborhoods_Buphalo_V1_TemplateTree_Map_Builder_FactoryInterface__TemplateTreeDirectoryPaths=$PWD/templates");

// Include Buphalo
require_once($PWD . '/../../../bin/v1/buphalo.php');

// Diff the two directories
exec("diff -r $PWD/control/ $PWD/fab/", $output, $return);

if ($return) {
echo(implode(PHP_EOL, $output) . PHP_EOL);
die(1);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
actors:
<PrimaryActorName>.php:
template: PrimaryActorName.php
annotation_processors:
FirstAnnotation:
processor_fqcn: \Neighborhoods\Buphalo\V1\AnnotationProcessors\EmptyString
SecondAnnotation:
processor_fqcn: \Neighborhoods\Buphalo\V1\AnnotationProcessors\SimpleString
static_context_record:
string: "public const SECOND = 'second';"
13 changes: 13 additions & 0 deletions tests/v1/MultipleSingleLineAPs/templates/PrimaryActorName.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php
declare(strict_types=1);

namespace Neighborhoods\BuphaloTemplateTree;

class PrimaryActorName
{
public const TEST_STRING = '/** @neighborhoods-buphalo:annotation-processor FirstAnnotation */';

public const IN_BETWEEN = 'in_between';

/** @neighborhoods-buphalo:annotation-processor SecondAnnotation */
}