From 4187b06be65d17caf3fb9176e77fd1a5cf2d9f5a Mon Sep 17 00:00:00 2001 From: Hafez Divandari Date: Wed, 24 Jan 2024 20:46:06 +0330 Subject: [PATCH] [11.x] Remove Database Deprecations (#49810) * remove schema deprecations * formatting * force re-run tests --- .../Query/Processors/MySqlProcessor.php | 15 ----- .../Query/Processors/PostgresProcessor.php | 15 ----- .../Database/Query/Processors/Processor.php | 13 ---- .../Query/Processors/SQLiteProcessor.php | 15 ----- .../Query/Processors/SqlServerProcessor.php | 15 ----- src/Illuminate/Database/Schema/Builder.php | 14 ----- .../Database/Schema/Grammars/MySqlGrammar.php | 48 -------------- .../Schema/Grammars/PostgresGrammar.php | 62 ------------------- .../Schema/Grammars/SQLiteGrammar.php | 49 --------------- .../Schema/Grammars/SqlServerGrammar.php | 49 --------------- .../Database/Schema/MySqlBuilder.php | 28 --------- .../Database/Schema/PostgresBuilder.php | 50 --------------- .../Database/Schema/SQLiteBuilder.php | 28 --------- .../Database/Schema/SqlServerBuilder.php | 28 --------- .../DatabasePostgresSchemaGrammarTest.php | 7 --- ...SqlSchemaBuilderAlterTableWithEnumTest.php | 15 ++--- .../DatabaseSqlServerSchemaBuilderTest.php | 22 +++---- .../DatabaseSqliteSchemaBuilderTest.php | 25 +++----- 18 files changed, 21 insertions(+), 477 deletions(-) diff --git a/src/Illuminate/Database/Query/Processors/MySqlProcessor.php b/src/Illuminate/Database/Query/Processors/MySqlProcessor.php index 091fc80b52b0..65d6101efb68 100644 --- a/src/Illuminate/Database/Query/Processors/MySqlProcessor.php +++ b/src/Illuminate/Database/Query/Processors/MySqlProcessor.php @@ -4,21 +4,6 @@ class MySqlProcessor extends Processor { - /** - * Process the results of a column listing query. - * - * @deprecated Will be removed in a future Laravel version. - * - * @param array $results - * @return array - */ - public function processColumnListing($results) - { - return array_map(function ($result) { - return ((object) $result)->column_name; - }, $results); - } - /** * Process the results of a columns query. * diff --git a/src/Illuminate/Database/Query/Processors/PostgresProcessor.php b/src/Illuminate/Database/Query/Processors/PostgresProcessor.php index e7b062785eb0..71c3e862ca37 100755 --- a/src/Illuminate/Database/Query/Processors/PostgresProcessor.php +++ b/src/Illuminate/Database/Query/Processors/PostgresProcessor.php @@ -30,21 +30,6 @@ public function processInsertGetId(Builder $query, $sql, $values, $sequence = nu return is_numeric($id) ? (int) $id : $id; } - /** - * Process the results of a column listing query. - * - * @deprecated Will be removed in a future Laravel version. - * - * @param array $results - * @return array - */ - public function processColumnListing($results) - { - return array_map(function ($result) { - return ((object) $result)->column_name; - }, $results); - } - /** * Process the results of a types query. * diff --git a/src/Illuminate/Database/Query/Processors/Processor.php b/src/Illuminate/Database/Query/Processors/Processor.php index 97a994ebc221..936e6245b170 100755 --- a/src/Illuminate/Database/Query/Processors/Processor.php +++ b/src/Illuminate/Database/Query/Processors/Processor.php @@ -120,17 +120,4 @@ public function processForeignKeys($results) { return $results; } - - /** - * Process the results of a column listing query. - * - * @deprecated Will be removed in a future Laravel version. - * - * @param array $results - * @return array - */ - public function processColumnListing($results) - { - return $results; - } } diff --git a/src/Illuminate/Database/Query/Processors/SQLiteProcessor.php b/src/Illuminate/Database/Query/Processors/SQLiteProcessor.php index 123718eb1ba0..63cc84c067da 100644 --- a/src/Illuminate/Database/Query/Processors/SQLiteProcessor.php +++ b/src/Illuminate/Database/Query/Processors/SQLiteProcessor.php @@ -4,21 +4,6 @@ class SQLiteProcessor extends Processor { - /** - * Process the results of a column listing query. - * - * @deprecated Will be removed in a future Laravel version. - * - * @param array $results - * @return array - */ - public function processColumnListing($results) - { - return array_map(function ($result) { - return ((object) $result)->name; - }, $results); - } - /** * Process the results of a columns query. * diff --git a/src/Illuminate/Database/Query/Processors/SqlServerProcessor.php b/src/Illuminate/Database/Query/Processors/SqlServerProcessor.php index c089593ed86a..8c632060b025 100755 --- a/src/Illuminate/Database/Query/Processors/SqlServerProcessor.php +++ b/src/Illuminate/Database/Query/Processors/SqlServerProcessor.php @@ -55,21 +55,6 @@ protected function processInsertGetIdForOdbc(Connection $connection) return is_object($row) ? $row->insertid : $row['insertid']; } - /** - * Process the results of a column listing query. - * - * @deprecated Will be removed in a future Laravel version. - * - * @param array $results - * @return array - */ - public function processColumnListing($results) - { - return array_map(function ($result) { - return ((object) $result)->name; - }, $results); - } - /** * Process the results of a columns query. * diff --git a/src/Illuminate/Database/Schema/Builder.php b/src/Illuminate/Database/Schema/Builder.php index 8f1fab2901e8..41bb00d2ea3d 100755 --- a/src/Illuminate/Database/Schema/Builder.php +++ b/src/Illuminate/Database/Schema/Builder.php @@ -206,20 +206,6 @@ public function getTypes() throw new LogicException('This database driver does not support user-defined types.'); } - /** - * Get all of the table names for the database. - * - * @deprecated Will be removed in a future Laravel version. - * - * @return array - * - * @throws \LogicException - */ - public function getAllTables() - { - throw new LogicException('This database driver does not support getting all tables.'); - } - /** * Determine if the given table has a given column. * diff --git a/src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php b/src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php index a0d9dab6d191..5a18e460bc15 100755 --- a/src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php +++ b/src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php @@ -66,18 +66,6 @@ public function compileDropDatabaseIfExists($name) ); } - /** - * Compile the query to determine the list of tables. - * - * @deprecated Will be removed in a future Laravel version. - * - * @return string - */ - public function compileTableExists() - { - return "select * from information_schema.tables where table_schema = ? and table_name = ? and table_type = 'BASE TABLE'"; - } - /** * Compile the query to determine the tables. * @@ -111,42 +99,6 @@ public function compileViews($database) ); } - /** - * Compile the SQL needed to retrieve all table names. - * - * @deprecated Will be removed in a future Laravel version. - * - * @return string - */ - public function compileGetAllTables() - { - return 'SHOW FULL TABLES WHERE table_type = \'BASE TABLE\''; - } - - /** - * Compile the SQL needed to retrieve all view names. - * - * @deprecated Will be removed in a future Laravel version. - * - * @return string - */ - public function compileGetAllViews() - { - return 'SHOW FULL TABLES WHERE table_type = \'VIEW\''; - } - - /** - * Compile the query to determine the list of columns. - * - * @deprecated Will be removed in a future Laravel version. - * - * @return string - */ - public function compileColumnListing() - { - return 'select column_name as `column_name` from information_schema.columns where table_schema = ? and table_name = ?'; - } - /** * Compile the query to determine the columns. * diff --git a/src/Illuminate/Database/Schema/Grammars/PostgresGrammar.php b/src/Illuminate/Database/Schema/Grammars/PostgresGrammar.php index d5d4902465eb..e1331c2b324e 100755 --- a/src/Illuminate/Database/Schema/Grammars/PostgresGrammar.php +++ b/src/Illuminate/Database/Schema/Grammars/PostgresGrammar.php @@ -68,18 +68,6 @@ public function compileDropDatabaseIfExists($name) ); } - /** - * Compile the query to determine if a table exists. - * - * @deprecated Will be removed in a future Laravel version. - * - * @return string - */ - public function compileTableExists() - { - return "select * from information_schema.tables where table_catalog = ? and table_schema = ? and table_name = ? and table_type = 'BASE TABLE'"; - } - /** * Compile the query to determine the tables. * @@ -121,44 +109,6 @@ public function compileTypes() ."and n.nspname not in ('pg_catalog', 'information_schema')"; } - /** - * Compile the SQL needed to retrieve all table names. - * - * @deprecated Will be removed in a future Laravel version. - * - * @param string|array $searchPath - * @return string - */ - public function compileGetAllTables($searchPath) - { - return "select tablename, concat('\"', schemaname, '\".\"', tablename, '\"') as qualifiedname from pg_catalog.pg_tables where schemaname in ('".implode("','", (array) $searchPath)."')"; - } - - /** - * Compile the SQL needed to retrieve all view names. - * - * @deprecated Will be removed in a future Laravel version. - * - * @param string|array $searchPath - * @return string - */ - public function compileGetAllViews($searchPath) - { - return "select viewname, concat('\"', schemaname, '\".\"', viewname, '\"') as qualifiedname from pg_catalog.pg_views where schemaname in ('".implode("','", (array) $searchPath)."')"; - } - - /** - * Compile the query to determine the list of columns. - * - * @deprecated Will be removed in a future Laravel version. - * - * @return string - */ - public function compileColumnListing() - { - return 'select column_name from information_schema.columns where table_catalog = ? and table_schema = ? and table_name = ?'; - } - /** * Compile the query to determine the columns. * @@ -510,18 +460,6 @@ public function compileDropAllDomains($domains) return 'drop domain '.implode(',', $this->escapeNames($domains)).' cascade'; } - /** - * Compile the SQL needed to retrieve all type names. - * - * @deprecated Will be removed in a future Laravel version. - * - * @return string - */ - public function compileGetAllTypes() - { - return 'select distinct pg_type.typname from pg_type inner join pg_enum on pg_enum.enumtypid = pg_type.oid'; - } - /** * Compile a drop column command. * diff --git a/src/Illuminate/Database/Schema/Grammars/SQLiteGrammar.php b/src/Illuminate/Database/Schema/Grammars/SQLiteGrammar.php index a8ddbb58c4ea..dfa072e3eabc 100644 --- a/src/Illuminate/Database/Schema/Grammars/SQLiteGrammar.php +++ b/src/Illuminate/Database/Schema/Grammars/SQLiteGrammar.php @@ -28,18 +28,6 @@ class SQLiteGrammar extends Grammar */ protected $serials = ['bigInteger', 'integer', 'mediumInteger', 'smallInteger', 'tinyInteger']; - /** - * Compile the query to determine if a table exists. - * - * @deprecated Will be removed in a future Laravel version. - * - * @return string - */ - public function compileTableExists() - { - return "select * from sqlite_master where type = 'table' and name = ?"; - } - /** * Compile the query to determine the SQL text that describes the given object. * @@ -92,43 +80,6 @@ public function compileViews() return "select name, sql as definition from sqlite_master where type = 'view' order by name"; } - /** - * Compile the SQL needed to retrieve all table names. - * - * @deprecated Will be removed in a future Laravel version. - * - * @return string - */ - public function compileGetAllTables() - { - return 'select type, name from sqlite_master where type = \'table\' and name not like \'sqlite_%\''; - } - - /** - * Compile the SQL needed to retrieve all view names. - * - * @deprecated Will be removed in a future Laravel version. - * - * @return string - */ - public function compileGetAllViews() - { - return 'select type, name from sqlite_master where type = \'view\''; - } - - /** - * Compile the query to determine the list of columns. - * - * @deprecated Will be removed in a future Laravel version. - * - * @param string $table - * @return string - */ - public function compileColumnListing($table) - { - return 'pragma table_info('.$this->wrap(str_replace('.', '__', $table)).')'; - } - /** * Compile the query to determine the columns. * diff --git a/src/Illuminate/Database/Schema/Grammars/SqlServerGrammar.php b/src/Illuminate/Database/Schema/Grammars/SqlServerGrammar.php index 7914b9c66368..7d589a5df05f 100755 --- a/src/Illuminate/Database/Schema/Grammars/SqlServerGrammar.php +++ b/src/Illuminate/Database/Schema/Grammars/SqlServerGrammar.php @@ -66,18 +66,6 @@ public function compileDropDatabaseIfExists($name) ); } - /** - * Compile the query to determine if a table exists. - * - * @deprecated Will be removed in a future Laravel version. - * - * @return string - */ - public function compileTableExists() - { - return "select * from sys.sysobjects where id = object_id(?) and xtype in ('U', 'V')"; - } - /** * Compile the query to determine the tables. * @@ -105,43 +93,6 @@ public function compileViews() .'order by name'; } - /** - * Compile the SQL needed to retrieve all table names. - * - * @deprecated Will be removed in a future Laravel version. - * - * @return string - */ - public function compileGetAllTables() - { - return "select name, type from sys.tables where type = 'U'"; - } - - /** - * Compile the SQL needed to retrieve all view names. - * - * @deprecated Will be removed in a future Laravel version. - * - * @return string - */ - public function compileGetAllViews() - { - return "select name, type from sys.objects where type = 'V'"; - } - - /** - * Compile the query to determine the list of columns. - * - * @deprecated Will be removed in a future Laravel version. - * - * @param string $table - * @return string - */ - public function compileColumnListing($table) - { - return "select name from sys.columns where object_id = object_id('$table')"; - } - /** * Compile the query to determine the columns. * diff --git a/src/Illuminate/Database/Schema/MySqlBuilder.php b/src/Illuminate/Database/Schema/MySqlBuilder.php index 0c537ba980cd..943ae9f4fadf 100755 --- a/src/Illuminate/Database/Schema/MySqlBuilder.php +++ b/src/Illuminate/Database/Schema/MySqlBuilder.php @@ -58,34 +58,6 @@ public function getViews() ); } - /** - * Get all of the table names for the database. - * - * @deprecated Will be removed in a future Laravel version. - * - * @return array - */ - public function getAllTables() - { - return $this->connection->select( - $this->grammar->compileGetAllTables() - ); - } - - /** - * Get all of the view names for the database. - * - * @deprecated Will be removed in a future Laravel version. - * - * @return array - */ - public function getAllViews() - { - return $this->connection->select( - $this->grammar->compileGetAllViews() - ); - } - /** * Get the columns for a given table. * diff --git a/src/Illuminate/Database/Schema/PostgresBuilder.php b/src/Illuminate/Database/Schema/PostgresBuilder.php index 9cf829721ad2..af89b07e8d63 100755 --- a/src/Illuminate/Database/Schema/PostgresBuilder.php +++ b/src/Illuminate/Database/Schema/PostgresBuilder.php @@ -71,42 +71,6 @@ public function getTypes() ); } - /** - * Get all of the table names for the database. - * - * @deprecated Will be removed in a future Laravel version. - * - * @return array - */ - public function getAllTables() - { - return $this->connection->select( - $this->grammar->compileGetAllTables( - $this->parseSearchPath( - $this->connection->getConfig('search_path') ?: $this->connection->getConfig('schema') - ) - ) - ); - } - - /** - * Get all of the view names for the database. - * - * @deprecated Will be removed in a future Laravel version. - * - * @return array - */ - public function getAllViews() - { - return $this->connection->select( - $this->grammar->compileGetAllViews( - $this->parseSearchPath( - $this->connection->getConfig('search_path') ?: $this->connection->getConfig('schema') - ) - ) - ); - } - /** * Drop all tables from the database. * @@ -166,20 +130,6 @@ public function dropAllViews() ); } - /** - * Get all of the type names for the database. - * - * @deprecated Will be removed in a future Laravel version. - * - * @return array - */ - public function getAllTypes() - { - return $this->connection->select( - $this->grammar->compileGetAllTypes() - ); - } - /** * Drop all types from the database. * diff --git a/src/Illuminate/Database/Schema/SQLiteBuilder.php b/src/Illuminate/Database/Schema/SQLiteBuilder.php index f1a89a1e9478..ef19684172fa 100644 --- a/src/Illuminate/Database/Schema/SQLiteBuilder.php +++ b/src/Illuminate/Database/Schema/SQLiteBuilder.php @@ -67,34 +67,6 @@ public function getColumns($table) ); } - /** - * Get all of the table names for the database. - * - * @deprecated Will be removed in a future Laravel version. - * - * @return array - */ - public function getAllTables() - { - return $this->connection->select( - $this->grammar->compileGetAllTables() - ); - } - - /** - * Get all of the view names for the database. - * - * @deprecated Will be removed in a future Laravel version. - * - * @return array - */ - public function getAllViews() - { - return $this->connection->select( - $this->grammar->compileGetAllViews() - ); - } - /** * Drop all tables from the database. * diff --git a/src/Illuminate/Database/Schema/SqlServerBuilder.php b/src/Illuminate/Database/Schema/SqlServerBuilder.php index e7717534f803..93da1cb86fad 100644 --- a/src/Illuminate/Database/Schema/SqlServerBuilder.php +++ b/src/Illuminate/Database/Schema/SqlServerBuilder.php @@ -51,32 +51,4 @@ public function dropAllViews() { $this->connection->statement($this->grammar->compileDropAllViews()); } - - /** - * Drop all tables from the database. - * - * @deprecated Will be removed in a future Laravel version. - * - * @return array - */ - public function getAllTables() - { - return $this->connection->select( - $this->grammar->compileGetAllTables() - ); - } - - /** - * Get all of the view names for the database. - * - * @deprecated Will be removed in a future Laravel version. - * - * @return array - */ - public function getAllViews() - { - return $this->connection->select( - $this->grammar->compileGetAllViews() - ); - } } diff --git a/tests/Database/DatabasePostgresSchemaGrammarTest.php b/tests/Database/DatabasePostgresSchemaGrammarTest.php index 38dcd2f1075d..c95601e92223 100755 --- a/tests/Database/DatabasePostgresSchemaGrammarTest.php +++ b/tests/Database/DatabasePostgresSchemaGrammarTest.php @@ -1214,13 +1214,6 @@ public function testDropAllTypesEscapesTableNames() $this->assertSame('drop type "alpha","beta","gamma" cascade', $statement); } - public function testCompileTableExists() - { - $statement = $this->getGrammar()->compileTableExists(); - - $this->assertSame('select * from information_schema.tables where table_catalog = ? and table_schema = ? and table_name = ? and table_type = \'BASE TABLE\'', $statement); - } - public function testCompileColumns() { $statement = $this->getGrammar()->compileColumns('public', 'table'); diff --git a/tests/Integration/Database/MySql/DatabaseMySqlSchemaBuilderAlterTableWithEnumTest.php b/tests/Integration/Database/MySql/DatabaseMySqlSchemaBuilderAlterTableWithEnumTest.php index 67eae4aab4ed..1fbb74fda5f8 100644 --- a/tests/Integration/Database/MySql/DatabaseMySqlSchemaBuilderAlterTableWithEnumTest.php +++ b/tests/Integration/Database/MySql/DatabaseMySqlSchemaBuilderAlterTableWithEnumTest.php @@ -6,7 +6,6 @@ use Illuminate\Support\Facades\Schema; use PHPUnit\Framework\Attributes\RequiresOperatingSystem; use PHPUnit\Framework\Attributes\RequiresPhpExtension; -use stdClass; #[RequiresOperatingSystem('Linux|Darwin')] #[RequiresPhpExtension('pdo_mysql')] @@ -45,18 +44,12 @@ public function testChangeColumnOnTableWithEnum() $this->assertSame('int', Schema::getColumnType('users', 'age')); } - public function testGetAllTablesAndColumnListing() + public function testGetTablesAndColumnListing() { - $tables = Schema::getAllTables(); + $tables = Schema::getTables(); $this->assertCount(2, $tables); - $tableProperties = array_values((array) $tables[0]); - $this->assertEquals(['migrations', 'BASE TABLE'], $tableProperties); - - $this->assertInstanceOf(stdClass::class, $tables[1]); - - $tableProperties = array_values((array) $tables[1]); - $this->assertEquals(['users', 'BASE TABLE'], $tableProperties); + $this->assertEquals(['migrations', 'users'], array_column($tables, 'name')); $columns = Schema::getColumnListing('users'); @@ -68,7 +61,7 @@ public function testGetAllTablesAndColumnListing() $table->integer('id'); $table->string('title'); }); - $tables = Schema::getAllTables(); + $tables = Schema::getTables(); $this->assertCount(3, $tables); Schema::drop('posts'); } diff --git a/tests/Integration/Database/SqlServer/DatabaseSqlServerSchemaBuilderTest.php b/tests/Integration/Database/SqlServer/DatabaseSqlServerSchemaBuilderTest.php index 3332983a3342..f332de17fcd2 100644 --- a/tests/Integration/Database/SqlServer/DatabaseSqlServerSchemaBuilderTest.php +++ b/tests/Integration/Database/SqlServer/DatabaseSqlServerSchemaBuilderTest.php @@ -5,7 +5,6 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Schema; -use stdClass; class DatabaseSqlServerSchemaBuilderTest extends SqlServerTestCase { @@ -25,20 +24,19 @@ protected function destroyDatabaseMigrations() DB::statement('drop view if exists users_view'); } - public function testGetAllTables() + public function testGetTables() { DB::statement('create view users_view AS select name, age from users'); - $rows = Schema::getAllTables(); + $rows = Schema::getTables(); - $this->assertContainsOnlyInstancesOf(stdClass::class, $rows); $this->assertGreaterThanOrEqual(2, count($rows)); $this->assertTrue( - collect($rows)->contains(fn ($row) => $row->name === 'migrations' && $row->type === 'U '), + collect($rows)->contains('name', 'migrations'), 'Failed asserting that table "migrations" was returned.' ); $this->assertTrue( - collect($rows)->contains(fn ($row) => $row->name === 'users' && $row->type === 'U '), + collect($rows)->contains('name', 'users'), 'Failed asserting that table "users" was returned.' ); $this->assertFalse( @@ -52,20 +50,18 @@ public function testColumnListing() $this->assertSame(['id', 'name', 'age', 'color'], Schema::getColumnListing('users')); } - public function testGetAllViews() + public function testGetViews() { DB::statement('create view users_view AS select name, age from users'); - $rows = Schema::getAllViews(); + $rows = Schema::getViews(); - $this->assertContainsOnlyInstancesOf(stdClass::class, $rows); $this->assertCount(1, $rows); - $this->assertSame('users_view', $rows[0]->name); - $this->assertSame('V ', $rows[0]->type); + $this->assertSame('users_view', $rows[0]['name']); } - public function testGetAllViewsWhenNoneExist() + public function testGetViewsWhenNoneExist() { - $this->assertSame([], Schema::getAllViews()); + $this->assertSame([], Schema::getViews()); } } diff --git a/tests/Integration/Database/Sqlite/DatabaseSqliteSchemaBuilderTest.php b/tests/Integration/Database/Sqlite/DatabaseSqliteSchemaBuilderTest.php index b11e852f0aa7..c7e4f44c4a55 100644 --- a/tests/Integration/Database/Sqlite/DatabaseSqliteSchemaBuilderTest.php +++ b/tests/Integration/Database/Sqlite/DatabaseSqliteSchemaBuilderTest.php @@ -6,7 +6,6 @@ use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Schema; use Illuminate\Tests\Integration\Database\DatabaseTestCase; -use stdClass; class DatabaseSqliteSchemaBuilderTest extends DatabaseTestCase { @@ -40,18 +39,12 @@ protected function destroyDatabaseMigrations() Schema::drop('users'); } - public function testGetAllTablesAndColumnListing() + public function testGetTablesAndColumnListing() { - $tables = Schema::getAllTables(); + $tables = Schema::getTables(); $this->assertCount(2, $tables); - $tableProperties = array_values((array) $tables[0]); - $this->assertEquals(['table', 'migrations'], $tableProperties); - - $this->assertInstanceOf(stdClass::class, $tables[1]); - - $tableProperties = array_values((array) $tables[1]); - $this->assertEquals(['table', 'users'], $tableProperties); + $this->assertEquals(['migrations', 'users'], array_column($tables, 'name')); $columns = Schema::getColumnListing('users'); @@ -63,12 +56,12 @@ public function testGetAllTablesAndColumnListing() $table->integer('id'); $table->string('title'); }); - $tables = Schema::getAllTables(); + $tables = Schema::getTables(); $this->assertCount(3, $tables); Schema::drop('posts'); } - public function testGetAllViews() + public function testGetViews() { DB::connection('conn1')->statement(<<<'SQL' CREATE VIEW users_view @@ -76,17 +69,15 @@ public function testGetAllViews() SELECT name,age from users; SQL); - $tableView = Schema::getAllViews(); + $tableView = Schema::getViews(); $this->assertCount(1, $tableView); - $this->assertInstanceOf(stdClass::class, $obj = array_values($tableView)[0]); - $this->assertEquals('users_view', $obj->name); - $this->assertEquals('view', $obj->type); + $this->assertEquals('users_view', $tableView[0]['name']); DB::connection('conn1')->statement(<<<'SQL' DROP VIEW IF EXISTS users_view; SQL); - $this->assertEmpty(Schema::getAllViews()); + $this->assertEmpty(Schema::getViews()); } }