From e3594acfb26733d439fa689451a55e743e6d1a06 Mon Sep 17 00:00:00 2001 From: Laravel Freelancer NL <36150929+LaravelFreelancerNL@users.noreply.github.com> Date: Thu, 5 Dec 2024 14:17:00 +0100 Subject: [PATCH] 135 support dbtable (#178) * ci: added drop-all to the test setup * chore: added missing methods to the docblock for better autocompletion * fix: fixed confusing functionality for getTables & getAllTables * fix: Renamed getAllViews to getViews for better Laravel naming compatibility * fix: Renamed getAllAnalyzers to getAnalyzers for better Laravel naming compatibility * fix: Renamed getAllGraphs to getGraphs for better Laravel naming compatibility * docs: streamlined styling and added functions * test fixed schema method calls * chore cleared unused function * test fixed default endpoint * feat Extended db:show with arangodb functionality * ci: ensure migrations are converted --- bin/qa.sh | 2 +- bin/test.sh | 3 +- docs/console-commands.md | 9 + docs/migrations.md | 15 +- phpunit.xml | 2 +- src/Console/ShowCommand.php | 343 +++++++++++++++++++++++ src/Facades/Schema.php | 16 +- src/Providers/CommandServiceProvider.php | 2 + src/Schema/Builder.php | 19 +- src/Schema/Concerns/HandlesAnalyzers.php | 2 +- src/Schema/Concerns/HandlesGraphs.php | 2 +- src/Schema/Concerns/HandlesViews.php | 2 +- tests/Console/DbShowCommandTest.php | 95 +++++++ tests/Pest.php | 17 -- tests/Schema/AnalyzerTest.php | 10 +- tests/Schema/GraphTest.php | 12 +- tests/Schema/SchemaBuilderTest.php | 10 +- tests/Schema/TableTest.php | 4 +- tests/Schema/ViewTest.php | 4 +- tests/Testing/DatabaseTruncationTest.php | 2 +- 20 files changed, 518 insertions(+), 53 deletions(-) create mode 100644 src/Console/ShowCommand.php create mode 100644 tests/Console/DbShowCommandTest.php diff --git a/bin/qa.sh b/bin/qa.sh index 0b2e54f..c9dd48d 100755 --- a/bin/qa.sh +++ b/bin/qa.sh @@ -10,6 +10,6 @@ echo "Run PHPStan" echo "Test package from within phpunit" ./vendor/bin/testbench convert:migrations -./vendor/bin/testbench migrate:fresh --path=TestSetup/Database/Migrations --path=vendor/orchestra/testbench-core/laravel/migrations/ --realpath --seed +./vendor/bin/testbench migrate:fresh --drop-all --path=TestSetup/Database/Migrations --path=vendor/orchestra/testbench-core/laravel/migrations/ --realpath --seed ./vendor/bin/testbench package:test --coverage --min=80 tests diff --git a/bin/test.sh b/bin/test.sh index 7a77a27..bf5fd45 100755 --- a/bin/test.sh +++ b/bin/test.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash printf "\nRun tests\n" -./vendor/bin/testbench migrate:fresh --path=TestSetup/Database/Migrations --path=vendor/orchestra/testbench-core/laravel/migrations/ --realpath --seed +./vendor/bin/testbench convert:migrations +./vendor/bin/testbench migrate:fresh --drop-all --path=TestSetup/Database/Migrations --path=vendor/orchestra/testbench-core/laravel/migrations/ --realpath --seed ./vendor/bin/testbench package:test --coverage --min=80 tests diff --git a/docs/console-commands.md b/docs/console-commands.md index 4b8dbf2..637f365 100644 --- a/docs/console-commands.md +++ b/docs/console-commands.md @@ -9,6 +9,15 @@ In addition, you have the option to clear the following in ArangoDB: * --drop-graphs: drop all named graphs * --drop-all: drop all of the above: tables, analyzers, views and graphs +## db:show +db:show gives you an overview of the current database and its tables. +In addition to the default Laravel options, you have the following: + +* --analyzers: show a list of available analyzers +* --views: show a list of available views +* --graphs: show a list of available named graphs +* --system: include system tables in the table list + ## Migrations _**Migrations for ArangoDB use a different Schema blueprint. Therefore, you either need to run the convert:migrations command first, or convert them manually**_ diff --git a/docs/migrations.md b/docs/migrations.md index deccb1a..a5b36e2 100644 --- a/docs/migrations.md +++ b/docs/migrations.md @@ -88,21 +88,26 @@ Schema::dropView($viewName); ## Analyzers (ArangoSearch) You can create, edit or delete an ArangoDB Analyzer. -### New Analyzer +### New analyzer ```php Schema::createAnalyzer($name, $type, $properties, $features); ``` -### Replace Analyzer +### Replace analyzer ```php Schema::replaceAnalyzer($name, $type, $properties, $features); ``` -### Delete Analyzer +### Delete analyzer ```php Schema::dropAnalyzer($name); ``` +### Delete all analyzers +```php +Schema::dropAnalyzers($name); +``` + ## Named Graphs Named graphs are predefined managed graphs which feature integrity checks compared to anonymous graphs. @@ -126,7 +131,7 @@ Schema::getGraph($name); ### Get all graphs ```php -Schema::getAllGraphs(); +Schema::getGraphs(); ``` ### Delete a graph @@ -141,5 +146,5 @@ Schema::dropGraphIfExists($name); ### Delete all graphs ```php -Schema::dropAllGraphs(); +Schema::dropGraphs(); ``` \ No newline at end of file diff --git a/phpunit.xml b/phpunit.xml index 5bc8a49..105e788 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -30,7 +30,7 @@ - + diff --git a/src/Console/ShowCommand.php b/src/Console/ShowCommand.php new file mode 100644 index 0000000..b5036cd --- /dev/null +++ b/src/Console/ShowCommand.php @@ -0,0 +1,343 @@ +connection($database = $this->input->getOption('database')); + + assert($connection instanceof Connection); + + if ($connection->getDriverName() !== 'arangodb') { + return parent::handle($connections); + } + + $schema = $connection->getSchemaBuilder(); + + $fullVersion = $this->getFullVersion($connection); + + $data = [ + 'platform' => [ + 'config' => $this->getConfigFromDatabase($database), + 'server' => $fullVersion->server ?? 'arango', + 'license' => $fullVersion->license ?? 'unknown', + 'name' => $connection->getDriverTitle(), + 'connection' => $connection->getName(), + 'version' => $fullVersion->version ?? 'unknown', + 'isSystemDatabase' => $this->getDatabaseInfo($connection), + 'open_connections' => $connection->threadCount(), + ], + 'tables' => $this->tables($connection, $schema), + ]; + + $data['views'] = $this->views($connection, $schema); + + $data['analyzers'] = $this->analyzers($schema); + + $data['graphs'] = $this->graphs($schema); + + $this->display($data, $connection); + + return 0; + } + + /** + * Render the database information. + * + * @param array $data + * @param Connection|null $connection + * @return void + */ + protected function display(array $data, ?Connection $connection = null) + { + $this->option('json') ? $this->displayJson($data) : $this->displayForCli($data, $connection); + } + + + /** + * Get information regarding the tables within the database. + * + * @param \Illuminate\Database\ConnectionInterface $connection + * @param IlluminateSchemaBuilder $schema + * @return \Illuminate\Support\Collection + */ + protected function tables(ConnectionInterface $connection, $schema) + { + assert($connection instanceof Connection); + + if ($connection->getDriverName() !== 'arangodb') { + return parent::tables($connection, $schema); + } + + assert($schema instanceof SchemaBuilder); + + // Get all tables + $tables = collect( + ($this->input->getOption('system')) ? $schema->getAllTables() : $schema->getTables(), + )->sortBy('name'); + + // Get per table statistics + $tableStats = []; + foreach ($tables as $table) { + $tableStats[] = $schema->getTable($table->name); + } + + return collect($tableStats)->map(fn($table) => [ + 'table' => $table['name'], + 'size' => $table['figures']->documentsSize, + 'rows' => $this->option('counts') + ? $table['count'] + : null, + ]); + } + + /** + * Get information regarding the views within the database. + * + * @param \Illuminate\Database\ConnectionInterface $connection + * @param \Illuminate\Database\Schema\Builder $schema + * @return \Illuminate\Support\Collection + */ + protected function views(ConnectionInterface $connection, IlluminateSchemaBuilder $schema) + { + assert($connection instanceof Connection); + + if ($connection->getDriverName() !== 'arangodb') { + return parent::views($connection, $schema); + } + + return collect($schema->getViews()) + ->map(fn($view) => [ + 'name' => $view->name, + 'type' => $view->type, + ]); + } + + /** + * Get information regarding the analyzers within the database. + * + * @param SchemaBuilder $schema + * @return \Illuminate\Support\Collection + */ + protected function analyzers(SchemaBuilder $schema) + { + return collect($schema->getAnalyzers()) + ->map(fn($analyzer) => [ + 'name' => $analyzer->name, + 'type' => $analyzer->type, + ]); + } + + /** + * Get information regarding the named graphs within the database. + * + * @param SchemaBuilder $schema + * @return \Illuminate\Support\Collection + */ + protected function graphs(SchemaBuilder $schema) + { + return collect($schema->getGraphs()) + ->map(fn($graph) => [ + 'name' => $graph->name, + 'edgeDefinitions' => count($graph->edgeDefinitions), + ]); + } + + protected function getFullVersion(Connection $connection): object + { + $client = $connection->getArangoClient(); + + assert($client !== null); + + return $client->admin()->getVersion(); + } + + /** + * @throws ArangoException + */ + protected function getDatabaseInfo(Connection $connection): bool + { + $client = $connection->getArangoClient(); + + assert($client !== null); + + $info = $client->schema()->getCurrentDatabase(); + + return $info->isSystem; + } + + /** + * @param mixed $views + * @return void + */ + public function displayViews(mixed $views): void + { + if (! $this->input->getOption('views') || $views->isEmpty()) { + return; + } + + $this->components->twoColumnDetail( + 'View', + 'Type', + ); + + $views->each(fn($view) => $this->components->twoColumnDetail( + $view['name'], + $view['type'], + )); + + $this->newLine(); + } + + /** + * @param mixed $analyzers + * @return void + */ + public function displayAnalyzers(mixed $analyzers): void + { + if (! $this->input->getOption('analyzers') || $analyzers->isEmpty()) { + return; + } + + $this->components->twoColumnDetail( + 'Analyzers', + 'Type', + ); + + $analyzers->each(fn($analyzer) => $this->components->twoColumnDetail( + $analyzer['name'], + $analyzer['type'], + )); + + $this->newLine(); + } + /** + * @param mixed $graphs + * @return void + */ + public function displayGraphs(mixed $graphs): void + { + if (! $this->input->getOption('graphs') || $graphs->isEmpty()) { + return; + } + + $this->components->twoColumnDetail( + 'Graphs', + 'Edge Definitions', + ); + + $graphs->each(fn($graph) => $this->components->twoColumnDetail( + $graph['name'], + $graph['edgeDefinitions'], + )); + + $this->newLine(); + } + + /** + * Render the database information formatted for the CLI. + * + * @param array $data + * @param Connection|null $connection + * @return void + */ + protected function displayForCli(array $data, ?Connection $connection = null) + { + if ($connection && $connection->getDriverName() !== 'arangodb') { + parent::displayForCli($data); + return; + } + + $platform = $data['platform']; + $tables = $data['tables']; + $analyzers = $data['analyzers'] ?? null; + $views = $data['views'] ?? null; + $graphs = $data['graphs'] ?? null; + + $this->newLine(); + + $this->components->twoColumnDetail('ArangoDB (' . ucfirst($platform['license']) . ' Edition)', '' . $platform['version'] . ''); + $this->components->twoColumnDetail('Connection', $platform['connection']); + $this->components->twoColumnDetail('Database', Arr::get($platform['config'], 'database')); + $this->components->twoColumnDetail('Host', Arr::get($platform['config'], 'host')); + $this->components->twoColumnDetail('Port', Arr::get($platform['config'], 'port')); + $this->components->twoColumnDetail('Username', Arr::get($platform['config'], 'username')); + $this->components->twoColumnDetail('URL', Arr::get($platform['config'], 'url') ?? Arr::get($platform['config'], 'endpoint')); + $this->components->twoColumnDetail('Open Connections', $platform['open_connections']); + $this->components->twoColumnDetail('Analyzers', $analyzers->count()); + $this->components->twoColumnDetail('Views', $views->count()); + $this->components->twoColumnDetail('Named Graphs', $graphs->count()); + $this->components->twoColumnDetail('Tables', $tables->count()); + + $tableSizeSum = $tables->sum('size'); + if ($tableSizeSum) { + $this->components->twoColumnDetail('Total Size Estimate', Number::fileSize($tableSizeSum, 2)); + } + + $this->newLine(); + + if ($tables->isNotEmpty()) { + $this->components->twoColumnDetail( + 'Table', + 'Size Estimate' . ($this->option('counts') ? ' / Rows' : ''), + ); + + $tables->each(function ($table) { + $tableSize = is_null($table['size']) ? null : Number::fileSize($table['size'], 2); + + $this->components->twoColumnDetail( + $table["table"], + ($tableSize ?? '—') . ($this->option('counts') ? ' / ' . Number::format($table['rows']) . '' : ''), + ); + }); + + $this->newLine(); + } + + $this->displayViews($views); + + $this->displayAnalyzers($analyzers); + + $this->displayGraphs($graphs); + } +} diff --git a/src/Facades/Schema.php b/src/Facades/Schema.php index 3e81995..c014376 100644 --- a/src/Facades/Schema.php +++ b/src/Facades/Schema.php @@ -12,7 +12,7 @@ * Table handling: * * @method static Builder create($collection, Closure $callback, $options = []) - * @method static Builder getAllTables() + * @method static Builder getTables() * @method static Builder drop(string $collection) * @method static Builder dropIfExists(string $collection) * @method static Builder dropAllTables() @@ -21,7 +21,9 @@ * * View handling: * @method static Builder createView($name, array $properties, $type = 'arangosearch') + * @method static Builder hasView(string $name) * @method static Builder getView(string $name) + * @method static Builder getViews() * @method static Builder editView($name, array $properties) * @method static Builder renameView(string $from, string $to) * @method static Builder dropView(string $name) @@ -29,10 +31,22 @@ * * Analyzer handling: * @method static Builder createAnalyzer($name, array $properties) + * @method static Builder hasAnalyzer() * @method static Builder getAnalyzer(string $name) + * @method static Builder getAnalyzers() * @method static Builder replaceAnalyzer($name, array $properties) * @method static Builder dropAnalyzer(string $name) * @method static Builder dropAnalyzerIfExists(string $name) + * @method static Builder dropAllAnalyzers() + * + * Named Graph handling: + * @method static Builder creategraph(string $name, array $properties = [], bool $waitForSync = false) + * @method static Builder hasGraph(string $name) + * @method static Builder getGraph(string $name) + * @method static Builder getGraphs() + * @method static Builder dropGraph(string $name) + * @method static Builder dropGraphIfExists(string $name) + * @method static Builder dropAllGraphs() * * @see \LaravelFreelancerNL\Aranguent\Schema\Builder */ diff --git a/src/Providers/CommandServiceProvider.php b/src/Providers/CommandServiceProvider.php index ffef389..2dd1c2b 100644 --- a/src/Providers/CommandServiceProvider.php +++ b/src/Providers/CommandServiceProvider.php @@ -4,6 +4,7 @@ namespace LaravelFreelancerNL\Aranguent\Providers; +use LaravelFreelancerNL\Aranguent\Console\ShowCommand; use LaravelFreelancerNL\Aranguent\Console\WipeCommand; use LaravelFreelancerNL\Aranguent\Console\DbCommand; use Illuminate\Database\Console\DbCommand as IlluminateDbCommand; @@ -23,6 +24,7 @@ class CommandServiceProvider extends ServiceProvider 'ModelMake' => ModelMakeCommand::class, 'Db' => DbCommand::class, 'DbWipe' => WipeCommand::class, + 'DbShow' => ShowCommand::class, ]; diff --git a/src/Schema/Builder.php b/src/Schema/Builder.php index 74de5ba..25a5d45 100644 --- a/src/Schema/Builder.php +++ b/src/Schema/Builder.php @@ -100,19 +100,32 @@ public function dropIfExists($table): void /** * Get all the tables for the database; excluding ArangoDB system collections * + * @param string $name + * @return array + * + * @throws ArangoException + */ + public function getTable($name): array + { + return (array) $this->schemaManager->getCollectionStatistics($name); + } + + /** + * Get all the tables for the database; including ArangoDB system tables + * * @return array * * @throws ArangoException */ public function getAllTables(): array { - return $this->schemaManager->getCollections(true); + return $this->schemaManager->getCollections(false); } /** * Get the tables that belong to the database. * - * @return array + * @return array * @throws ArangoException */ public function getTables() @@ -150,7 +163,7 @@ public function drop($table) */ public function dropAllTables(): void { - $collections = $this->getAllTables(); + $collections = $this->getTables(true); foreach ($collections as $name) { $this->schemaManager->deleteCollection($name->name); diff --git a/src/Schema/Concerns/HandlesAnalyzers.php b/src/Schema/Concerns/HandlesAnalyzers.php index f086991..466a168 100644 --- a/src/Schema/Concerns/HandlesAnalyzers.php +++ b/src/Schema/Concerns/HandlesAnalyzers.php @@ -62,7 +62,7 @@ public function hasAnalyzer(string $analyzer): bool /** * @throws ArangoException */ - public function getAllAnalyzers(): array + public function getAnalyzers(): array { return $this->schemaManager->getAnalyzers(); } diff --git a/src/Schema/Concerns/HandlesGraphs.php b/src/Schema/Concerns/HandlesGraphs.php index 190d600..bb03245 100644 --- a/src/Schema/Concerns/HandlesGraphs.php +++ b/src/Schema/Concerns/HandlesGraphs.php @@ -37,7 +37,7 @@ public function getGraph(string $name): \stdClass /** * @throws ArangoException */ - public function getAllGraphs(): array + public function getGraphs(): array { return $this->schemaManager->getGraphs(); } diff --git a/src/Schema/Concerns/HandlesViews.php b/src/Schema/Concerns/HandlesViews.php index 5b09842..f36cffd 100644 --- a/src/Schema/Concerns/HandlesViews.php +++ b/src/Schema/Concerns/HandlesViews.php @@ -40,7 +40,7 @@ public function hasView($view) /** * @throws ArangoException */ - public function getAllViews(): array + public function getViews(): array { return $this->schemaManager->getViews(); } diff --git a/tests/Console/DbShowCommandTest.php b/tests/Console/DbShowCommandTest.php new file mode 100644 index 0000000..d06cd57 --- /dev/null +++ b/tests/Console/DbShowCommandTest.php @@ -0,0 +1,95 @@ +artisan('db:show') + ->expectsOutputToContain('Connection') + ->expectsOutputToContain('Database') + ->expectsOutputToContain('Analyzers') + ->expectsOutputToContain('Views') + ->expectsOutputToContain('Named Graphs') + ->expectsOutputToContain('characters') + ->expectsOutputToContain('users') + ->assertSuccessful(); +}); + +test('db:show --counts', function () { + $this->artisan( + 'db:show', + [ + '--counts' => true, + ], + ) + ->expectsOutputToContain('Size Estimate / Rows') + ->expectsOutputToContain('/ 43') + ->assertSuccessful(); +}); + + +test('db:show --analyzers', function () { + $this->artisan( + 'db:show', + [ + '--analyzers' => true, + ], + ) + ->expectsOutputToContain('Analyzers') + ->expectsOutputToContain('text_nl') + ->expectsOutputToContain('identity') + ->assertSuccessful(); +}); + +test('db:show --views', function () { + $this->artisan( + 'db:show', + [ + '--views' => true, + ], + ) + ->expectsOutputToContain('View') + ->expectsOutputToContain('house_search_alias_view') + ->expectsOutputToContain('arangosearch') + ->assertSuccessful(); +}); + +test('db:show --graphs', function () { + $this->schemaManager = $this->connection->getArangoClient()->schema(); + + $this->schemaManager->createGraph( + 'relatives', + [ + 'edgeDefinitions' => [ + [ + 'collection' => 'children', + 'from' => ['characters'], + 'to' => ['characters'], + ], + ], + ], + ); + + $this->artisan( + 'db:show', + [ + '--graphs' => true, + ], + ) + ->expectsOutputToContain('Graphs') + ->expectsOutputToContain('relatives') + ->assertSuccessful(); + + + $this->schemaManager->deleteGraph('relatives'); +}); + +test('db:show --system', function () { + $this->artisan( + 'db:show', + [ + '--system' => true, + ], + ) + ->expectsOutputToContain('_analyzers') + ->expectsOutputToContain('_jobs') + ->expectsOutputToContain('_queues') + ->assertSuccessful(); +}); diff --git a/tests/Pest.php b/tests/Pest.php index f76a4c4..7c223d6 100644 --- a/tests/Pest.php +++ b/tests/Pest.php @@ -78,23 +78,6 @@ function refreshDatabase() ]); } -/** - * The parameters that should be used when running "migrate:fresh". - * - * @return array - */ -//function migrateFreshUsing() -//{ -// ray('my migrateFreshUsing Pest.php'); -// return [ -// '--realpath' => true, -// '--path' => __DIR__ . '/../vendor/orchestra/testbench-core/laravel/migrations/', -// '--seed' => true, -// '--seeder' => DatabaseSeeder::class, -// ]; -//} - - function runCommand($command, $input = []) { return $command->run(new ArrayInput($input), new NullOutput()); diff --git a/tests/Schema/AnalyzerTest.php b/tests/Schema/AnalyzerTest.php index bdcf8f1..b662f5b 100644 --- a/tests/Schema/AnalyzerTest.php +++ b/tests/Schema/AnalyzerTest.php @@ -19,10 +19,10 @@ $schemaManager->deleteAnalyzer('myAnalyzer'); }); -test('getAllAnalyzers', function () { +test('getAnalyzers', function () { $schemaManager = $this->connection->getArangoClient()->schema(); - $analyzers = Schema::getAllAnalyzers(); + $analyzers = Schema::getAnalyzers(); expect($analyzers)->toHaveCount(13); }); @@ -67,16 +67,16 @@ test('dropAllAnalyzers', function () { $schemaManager = $this->connection->getArangoClient()->schema(); - $initialAnalyzers = Schema::getAllAnalyzers(); + $initialAnalyzers = Schema::getAnalyzers(); Schema::createAnalyzer('myAnalyzer1', 'identity'); Schema::createAnalyzer('myAnalyzer2', 'identity'); - $totalAnalyzers = Schema::getAllAnalyzers(); + $totalAnalyzers = Schema::getAnalyzers(); Schema::dropAllAnalyzers(); - $endAnalyzers = Schema::getAllAnalyzers(); + $endAnalyzers = Schema::getAnalyzers(); expect(count($initialAnalyzers))->toBe(count($endAnalyzers)); expect(count($initialAnalyzers))->toBe(count($totalAnalyzers) - 2); diff --git a/tests/Schema/GraphTest.php b/tests/Schema/GraphTest.php index 0de0a2c..9358f00 100644 --- a/tests/Schema/GraphTest.php +++ b/tests/Schema/GraphTest.php @@ -38,17 +38,17 @@ function createGraph() expect($graphExists)->toBeFalse(); }); -test('getAllGraphs', function () { +test('getGraphs', function () { $schemaManager = $this->connection->getArangoClient()->schema(); - $graphs = Schema::getAllGraphs(); + $graphs = Schema::getGraphs(); expect($graphs)->toHaveCount(0); if (!$schemaManager->hasGraph('myGraph')) { createGraph(); } - $graphs = Schema::getAllGraphs(); + $graphs = Schema::getGraphs(); expect($graphs)->toHaveCount(1); }); @@ -82,16 +82,16 @@ function createGraph() test('dropAllGraphs', function () { $schemaManager = $this->connection->getArangoClient()->schema(); - $initialGraphs = Schema::getAllGraphs(); + $initialGraphs = Schema::getGraphs(); Schema::createGraph('myGraph1'); Schema::createGraph('myGraph2'); - $totalGraphs = Schema::getAllGraphs(); + $totalGraphs = Schema::getGraphs(); Schema::dropAllGraphs(); - $endGraphs = Schema::getAllGraphs(); + $endGraphs = Schema::getGraphs(); expect(count($initialGraphs))->toBe(count($endGraphs)); expect(count($initialGraphs))->toBe(count($totalGraphs) - 2); diff --git a/tests/Schema/SchemaBuilderTest.php b/tests/Schema/SchemaBuilderTest.php index dbf5f55..a0f40ef 100644 --- a/tests/Schema/SchemaBuilderTest.php +++ b/tests/Schema/SchemaBuilderTest.php @@ -45,10 +45,10 @@ }); test('drop all tables', function () { - $initialTables = Schema::getAllTables(); + $initialTables = Schema::getTables(); Schema::dropAllTables(); - $tables = Schema::getAllTables(); + $tables = Schema::getTables(); expect(count($initialTables))->toEqual($this->tableCount); expect(count($tables))->toEqual(0); @@ -102,7 +102,7 @@ Schema::createView('search', []); } - $views = Schema::getAllViews(); + $views = Schema::getViews(); expect($views)->toHaveCount(5); expect($views[0]->name)->toBe('house_search_alias_view'); @@ -226,10 +226,10 @@ $schemaManager->deleteAnalyzer('myAnalyzer'); }); -test('getAllAnalyzers', function () { +test('getAnalyzers', function () { $schemaManager = $this->connection->getArangoClient()->schema(); - $analyzers = Schema::getAllAnalyzers(); + $analyzers = Schema::getAnalyzers(); expect($analyzers)->toHaveCount(13); }); diff --git a/tests/Schema/TableTest.php b/tests/Schema/TableTest.php index 516d297..05af1ea 100644 --- a/tests/Schema/TableTest.php +++ b/tests/Schema/TableTest.php @@ -95,11 +95,11 @@ }); test('dropAllTables', function () { - $initialTables = Schema::getAllTables(); + $initialTables = Schema::getTables(); Schema::dropAllTables(); - $tables = Schema::getAllTables(); + $tables = Schema::getTables(); expect(count($initialTables))->toEqual($this->tableCount); expect(count($tables))->toEqual(0); diff --git a/tests/Schema/ViewTest.php b/tests/Schema/ViewTest.php index 806fe80..03dc464 100644 --- a/tests/Schema/ViewTest.php +++ b/tests/Schema/ViewTest.php @@ -28,7 +28,7 @@ $schemaManager->deleteView('search'); }); -test('getAllViews', function () { +test('getViews', function () { $schemaManager = $this->connection->getArangoClient()->schema(); if (!$schemaManager->hasView('pages')) { Schema::createView('pages', []); @@ -40,7 +40,7 @@ Schema::createView('search', []); } - $views = Schema::getAllViews(); + $views = Schema::getViews(); expect($views)->toHaveCount(5); expect($views[0]->name)->toBe('house_search_alias_view'); diff --git a/tests/Testing/DatabaseTruncationTest.php b/tests/Testing/DatabaseTruncationTest.php index b508707..de1cf2d 100644 --- a/tests/Testing/DatabaseTruncationTest.php +++ b/tests/Testing/DatabaseTruncationTest.php @@ -9,7 +9,7 @@ uses(DatabaseTruncation::class); test('Ensure all tables are present', function () { - $tables = Schema::getAllTables(); + $tables = Schema::getTables(); expect(count($tables))->toEqual($this->tableCount); });