Skip to content

Commit 47097d3

Browse files
committed
Merge pull request #73 from jaapio/feature/projectName
add project name to projectfactory
2 parents c311a47 + dd1df3e commit 47097d3

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

src/phpDocumentor/Reflection/Php/ProjectFactory.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,14 @@ public function __construct($strategies)
3939
/**
4040
* Creates a project from the set of files.
4141
*
42+
* @param string $name
4243
* @param string[] $files
4344
* @return Project
4445
* @throws Exception when no matching strategy was found.
4546
*/
46-
public function create(array $files)
47+
public function create($name, array $files)
4748
{
48-
$project = new Project('MyProject');
49+
$project = new Project($name);
4950

5051
foreach ($files as $filePath) {
5152
$strategy = $this->strategies->findMatching($filePath);

tests/component/ProjectCreationTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function testCreateProjectWithFunctions()
6565
{
6666
$fileName = __DIR__ . '/project/simpleFunction.php';
6767

68-
$project = $this->fixture->create([
68+
$project = $this->fixture->create('MyProject',[
6969
$fileName
7070
]);
7171

@@ -76,7 +76,7 @@ public function testCreateProjectWithFunctions()
7676
public function testCreateProjectWithClass()
7777
{
7878
$fileName = __DIR__ . '/project/Pizza.php';
79-
$project = $this->fixture->create([
79+
$project = $this->fixture->create('MyProject', [
8080
$fileName
8181
]);
8282

@@ -88,7 +88,7 @@ public function testCreateProjectWithClass()
8888
public function testWithNamespacedClass()
8989
{
9090
$fileName = __DIR__ . '/project/Luigi/Pizza.php';
91-
$project = $this->fixture->create([
91+
$project = $this->fixture->create('MyProject', [
9292
$fileName
9393
]);
9494

@@ -112,7 +112,7 @@ public function testWithNamespacedClass()
112112
public function testDocblockOfMethodIsProcessed()
113113
{
114114
$fileName = __DIR__ . '/project/Luigi/Pizza.php';
115-
$project = $this->fixture->create([
115+
$project = $this->fixture->create('MyProject', [
116116
$fileName
117117
]);
118118

@@ -137,7 +137,7 @@ public function testDocblockOfMethodIsProcessed()
137137
public function testWithUsedParent()
138138
{
139139
$fileName = __DIR__ . '/project/Luigi/StyleFactory.php';
140-
$project = $this->fixture->create([
140+
$project = $this->fixture->create('MyProject', [
141141
$fileName
142142
]);
143143

@@ -149,7 +149,7 @@ public function testWithUsedParent()
149149
public function testWithInterface()
150150
{
151151
$fileName = __DIR__ . '/project/Luigi/Valued.php';
152-
$project = $this->fixture->create([
152+
$project = $this->fixture->create('MyProject', [
153153
$fileName
154154
]);
155155

@@ -159,7 +159,7 @@ public function testWithInterface()
159159
public function testWithTrait()
160160
{
161161
$fileName = __DIR__ . '/project/Luigi/ExampleNestedTrait.php';
162-
$project = $this->fixture->create([
162+
$project = $this->fixture->create('MyProject', [
163163
$fileName
164164
]);
165165

tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function testCreate()
5353
$projectFactory = new ProjectFactory(array($someOtherStrategy, $fileStrategyMock));
5454

5555
$files = array('some/file.php', 'some/other.php');
56-
$project = $projectFactory->create($files);
56+
$project = $projectFactory->create('MyProject', $files);
5757

5858
$this->assertInstanceOf(Project::class, $project);
5959

@@ -67,7 +67,7 @@ public function testCreate()
6767
public function testCreateThrowsExceptionWhenStrategyNotFound()
6868
{
6969
$projectFactory = new ProjectFactory(array());
70-
$projectFactory->create(array('aa'));
70+
$projectFactory->create('MyProject', array('aa'));
7171
}
7272

7373
public function testCreateProjectFromFileWithNamespacedClass()

0 commit comments

Comments
 (0)