Skip to content

Commit 38a822f

Browse files
author
Tim Helfensdörfer
committed
Require php 7.2 and laravel 6 because of phpunit 8
1 parent f42cd4f commit 38a822f

39 files changed

+6592
-6050
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
/vendor
22
composer.lock
33
.vscode
4+
.phpunit.result.cache

composer.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@
1212
}
1313
],
1414
"require": {
15-
"php": ">=7.0.0",
16-
"illuminate/database": "~5.5.0|~5.6.0|~5.7.0|~5.8.0|~5.9.0|~6.0.0",
17-
"illuminate/events": "~5.5.0|~5.6.0|~5.7.0|~5.8.0|~5.9.0|~6.0.0",
18-
"illuminate/support": "~5.5.0|~5.6.0|~5.7.0|~5.8.0|~5.9.0|~6.0.0"
15+
"php": ">=7.2.0",
16+
"illuminate/database": "^6.0",
17+
"illuminate/events": "^6.0",
18+
"illuminate/support": "^6.0"
1919
},
2020
"require-dev": {
21-
"d11wtq/boris": "~1.0.10",
21+
"d11wtq/boris": "^1.0",
2222
"doctrine/dbal": "*",
2323
"mockery/mockery": "^1.0",
24-
"phpunit/phpunit": "^7.0",
24+
"phpunit/phpunit": "^8.0",
2525
"squizlabs/php_codesniffer": "^3.4"
2626
},
2727
"autoload": {

src/Console/BaumCommand.php

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,37 @@
11
<?php
2+
23
namespace Baum\Console;
34

45
use Illuminate\Console\Command;
56
use Baum\Providers\BaumServiceProvider as Baum;
67

7-
class BaumCommand extends Command {
8+
class BaumCommand extends Command
9+
{
810

9-
/**
10-
* The console command name.
11-
*
12-
* @var string
13-
*/
14-
protected $name = 'baum';
11+
/**
12+
* The console command name.
13+
*
14+
* @var string
15+
*/
16+
protected $name = 'baum';
1517

16-
/**
17-
* The console command description.
18-
*
19-
* @var string
20-
*/
21-
protected $description = 'Get Baum version notice.';
18+
/**
19+
* The console command description.
20+
*
21+
* @var string
22+
*/
23+
protected $description = 'Get Baum version notice.';
2224

23-
/**
24-
* Execute the console command.
25-
*
26-
* @return void
27-
*/
28-
public function fire() {
29-
$this->line('<info>Baum</info> version <comment>' . Baum::VERSION . '</comment>');
30-
$this->line('A Nested Set pattern implementation for the Eloquent ORM.');
31-
$this->line('<comment>Copyright (c) 2013 Estanislau Trepat</comment>');
32-
}
25+
/**
26+
* Execute the console command.
27+
*
28+
* @return void
29+
*/
30+
public function fire()
31+
{
32+
$this->line('<info>Baum</info> version <comment>' . Baum::VERSION . '</comment>');
33+
$this->line('A Nested Set pattern implementation for the Eloquent ORM.');
34+
$this->line('<comment>Copyright (c) 2013 Estanislau Trepat</comment>');
35+
}
3336

3437
}

src/Console/InstallCommand.php

Lines changed: 122 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -1,123 +1,132 @@
11
<?php
2+
23
namespace Baum\Console;
34

45
use Baum\Generators\MigrationGenerator;
56
use Baum\Generators\ModelGenerator;
67
use Illuminate\Console\Command;
78
use Symfony\Component\Console\Input\InputArgument;
89

9-
class InstallCommand extends Command {
10-
11-
/**
12-
* The console command name.
13-
*
14-
* @var string
15-
*/
16-
protected $name = 'baum:install';
17-
18-
/**
19-
* The console command description.
20-
*
21-
* @var string
22-
*/
23-
protected $description = 'Scaffolds a new migration and model suitable for Baum.';
24-
25-
/**
26-
* Migration generator instance
27-
*
28-
* @var Baum\Generators\MigrationGenerator
29-
*/
30-
protected $migrator;
31-
32-
/**
33-
* Model generator instance
34-
*
35-
* @var Baum\Generators\ModelGenerator
36-
*/
37-
protected $modeler;
38-
39-
/**
40-
* Create a new command instance
41-
*
42-
* @return void
43-
*/
44-
public function __construct(MigrationGenerator $migrator, ModelGenerator $modeler) {
45-
parent::__construct();
46-
47-
$this->migrator = $migrator;
48-
$this->modeler = $modeler;
49-
}
50-
51-
/**
52-
* Execute the console command.
53-
*
54-
* Basically, we'll write the migration and model stubs out to disk inflected
55-
* with the name provided. Once its done, we'll `dump-autoload` for the entire
56-
* framework to make sure that the new classes are registered by the class
57-
* loaders.
58-
*
59-
* @return void
60-
*/
61-
public function fire() {
62-
$name = $this->input->getArgument('name');
63-
64-
$this->writeMigration($name);
65-
66-
$this->writeModel($name);
67-
68-
}
69-
70-
/**
71-
* Get the command arguments
72-
*
73-
* @return array
74-
*/
75-
protected function getArguments() {
76-
return array(
77-
array('name', InputArgument::REQUIRED, 'Name to use for the scaffolding of the migration and model.')
78-
);
79-
}
80-
81-
/**
82-
* Write the migration file to disk.
83-
*
84-
* @param string $name
85-
* @return string
86-
*/
87-
protected function writeMigration($name) {
88-
$output = pathinfo($this->migrator->create($name, $this->getMigrationsPath()), PATHINFO_FILENAME);
89-
90-
$this->line(" <fg=green;options=bold>create</fg=green;options=bold> $output");
91-
}
92-
93-
/**
94-
* Write the model file to disk.
95-
*
96-
* @param string $name
97-
* @return string
98-
*/
99-
protected function writeModel($name) {
100-
$output = pathinfo($this->modeler->create($name, $this->getModelsPath()), PATHINFO_FILENAME);
101-
102-
$this->line(" <fg=green;options=bold>create</fg=green;options=bold> $output");
103-
}
104-
105-
/**
106-
* Get the path to the migrations directory.
107-
*
108-
* @return string
109-
*/
110-
protected function getMigrationsPath() {
111-
return $this->laravel['path.database'].'/migrations';
112-
}
113-
114-
/**
115-
* Get the path to the models directory.
116-
*
117-
* @return string
118-
*/
119-
protected function getModelsPath() {
120-
return $this->laravel['path.base'];
121-
}
10+
class InstallCommand extends Command
11+
{
12+
13+
/**
14+
* The console command name.
15+
*
16+
* @var string
17+
*/
18+
protected $name = 'baum:install';
19+
20+
/**
21+
* The console command description.
22+
*
23+
* @var string
24+
*/
25+
protected $description = 'Scaffolds a new migration and model suitable for Baum.';
26+
27+
/**
28+
* Migration generator instance
29+
*
30+
* @var Baum\Generators\MigrationGenerator
31+
*/
32+
protected $migrator;
33+
34+
/**
35+
* Model generator instance
36+
*
37+
* @var Baum\Generators\ModelGenerator
38+
*/
39+
protected $modeler;
40+
41+
/**
42+
* Create a new command instance
43+
*
44+
* @return void
45+
*/
46+
public function __construct(MigrationGenerator $migrator, ModelGenerator $modeler)
47+
{
48+
parent::__construct();
49+
50+
$this->migrator = $migrator;
51+
$this->modeler = $modeler;
52+
}
53+
54+
/**
55+
* Execute the console command.
56+
*
57+
* Basically, we'll write the migration and model stubs out to disk inflected
58+
* with the name provided. Once its done, we'll `dump-autoload` for the entire
59+
* framework to make sure that the new classes are registered by the class
60+
* loaders.
61+
*
62+
* @return void
63+
*/
64+
public function fire()
65+
{
66+
$name = $this->input->getArgument('name');
67+
68+
$this->writeMigration($name);
69+
70+
$this->writeModel($name);
71+
72+
}
73+
74+
/**
75+
* Get the command arguments
76+
*
77+
* @return array
78+
*/
79+
protected function getArguments()
80+
{
81+
return array(
82+
array('name', InputArgument::REQUIRED, 'Name to use for the scaffolding of the migration and model.')
83+
);
84+
}
85+
86+
/**
87+
* Write the migration file to disk.
88+
*
89+
* @param string $name
90+
* @return string
91+
*/
92+
protected function writeMigration($name)
93+
{
94+
$output = pathinfo($this->migrator->create($name, $this->getMigrationsPath()), PATHINFO_FILENAME);
95+
96+
$this->line(" <fg=green;options=bold>create</fg=green;options=bold> $output");
97+
}
98+
99+
/**
100+
* Write the model file to disk.
101+
*
102+
* @param string $name
103+
* @return string
104+
*/
105+
protected function writeModel($name)
106+
{
107+
$output = pathinfo($this->modeler->create($name, $this->getModelsPath()), PATHINFO_FILENAME);
108+
109+
$this->line(" <fg=green;options=bold>create</fg=green;options=bold> $output");
110+
}
111+
112+
/**
113+
* Get the path to the migrations directory.
114+
*
115+
* @return string
116+
*/
117+
protected function getMigrationsPath()
118+
{
119+
return $this->laravel['path.database'] . '/migrations';
120+
}
121+
122+
/**
123+
* Get the path to the models directory.
124+
*
125+
* @return string
126+
*/
127+
protected function getModelsPath()
128+
{
129+
return $this->laravel['path.base'];
130+
}
122131

123132
}

0 commit comments

Comments
 (0)