Updates the database tests

This commit is contained in:
huangzhhui 2019-01-13 03:06:53 +08:00
parent 691e82f75a
commit 14fd640ec9
61 changed files with 574 additions and 284 deletions

3
bootstrap.php Normal file
View File

@ -0,0 +1,3 @@
<?php
! defined('BASE_PATH') && define('BASE_PATH', __DIR__);
require_once BASE_PATH . '/vendor/autoload.php';

21
phpunit.xml Normal file
View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="./bootstrap.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false">
<testsuites>
<testsuite name="Tests">
<directory suffix="Test.php">./src/database/tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./app</directory>
</whitelist>
</filter>
</phpunit>

View File

@ -0,0 +1,265 @@
<?php
namespace Hyperf\Database\Capsule;
use Hyperf\Config\Config;
use Hyperf\Contract\ConfigInterface;
use Hyperf\Database\Model\Register;
use Hyperf\Di\Annotation\Scanner;
use Hyperf\Di\Definition\DefinitionSource;
use PDO;
use Psr\Container\ContainerInterface as Container;
use Hyperf\Database\DatabaseManager;
use Psr\EventDispatcher\EventDispatcherInterface as Dispatcher;
use Hyperf\Database\Model\Model;
use Hyperf\Database\Connectors\ConnectionFactory;
use Psr\EventDispatcher\EventDispatcherInterface;
class Manager
{
/**
* The database manager instance.
*
* @var DatabaseManager
*/
protected $manager;
/**
* The current globally used instance.
*
* @var object
*/
protected static $instance;
/**
* The container instance.
*
* @var \Psr\Container\ContainerInterface
*/
protected $container;
/**
* Create a new database capsule manager.
*/
public function __construct(Container $container = null)
{
if (is_null($container)) {
$container = new \Hyperf\Di\Container(new DefinitionSource([], [], new Scanner()));
}
$this->setupContainer($container);
// Once we have the container setup, we will setup the default configuration
// options in the container "config" binding. This will make the database
// manager work correctly out of the box without extreme configuration.
$this->setupDefaultConfiguration();
$this->setupManager();
}
/**
* Setup the IoC container instance.
*
* @param \Psr\Container\ContainerInterface $container
* @return void
*/
protected function setupContainer(Container $container)
{
$this->container = $container;
if (! $this->container->has(ConfigInterface::class)) {
$this->container->instance(ConfigInterface::class, new Config([]));
}
}
/**
* Make this capsule instance available globally.
*
* @return void
*/
public function setAsGlobal()
{
static::$instance = $this;
}
/**
* Get the IoC container instance.
*
* @return \Psr\Container\ContainerInterface
*/
public function getContainer()
{
return $this->container;
}
/**
* Set the IoC container instance.
*
* @param \Psr\Container\ContainerInterface $container
* @return void
*/
public function setContainer(Container $container)
{
$this->container = $container;
}
/**
* Setup the default database configuration options.
*
* @return void
*/
protected function setupDefaultConfiguration()
{
$this->container['config']['database.fetch'] = PDO::FETCH_OBJ;
$this->container['config']['database.default'] = 'default';
}
/**
* Build the database manager instance.
*
* @return void
*/
protected function setupManager()
{
$factory = new ConnectionFactory($this->container);
$this->manager = new DatabaseManager($this->container, $factory);
}
/**
* Get a connection instance from the global manager.
*
* @param string $connection
* @return \Illuminate\Database\Connection
*/
public static function connection($connection = null)
{
return static::$instance->getConnection($connection);
}
/**
* Get a fluent query builder instance.
*
* @param string $table
* @param string $connection
* @return \Illuminate\Database\Query\Builder
*/
public static function table($table, $connection = null)
{
return static::$instance->connection($connection)->table($table);
}
/**
* Get a schema builder instance.
*
* @param string $connection
* @return \Illuminate\Database\Schema\Builder
*/
public static function schema($connection = null)
{
return static::$instance->connection($connection)->getSchemaBuilder();
}
/**
* Get a registered connection instance.
*
* @param string $name
* @return \Illuminate\Database\Connection
*/
public function getConnection($name = null)
{
return $this->manager->connection($name);
}
/**
* Register a connection with the manager.
*
* @param array $config
* @param string $name
* @return void
*/
public function addConnection(array $config, $name = 'default')
{
$connections = $this->container['config']['database.connections'];
$connections[$name] = $config;
$this->container['config']['database.connections'] = $connections;
}
/**
* Bootstrap Eloquent so it is ready for usage.
*
* @return void
*/
public function bootEloquent()
{
Register::setConnectionResolver($this->manager);
// If we have an event dispatcher instance, we will go ahead and register it
// with the Eloquent ORM, allowing for model callbacks while creating and
// updating "model" instances; however, it is not necessary to operate.
if ($dispatcher = $this->getEventDispatcher()) {
Register::setEventDispatcher($dispatcher);
}
}
/**
* Set the fetch mode for the database connections.
*
* @param int $fetchMode
* @return $this
*/
public function setFetchMode($fetchMode)
{
$this->container['config']['database.fetch'] = $fetchMode;
return $this;
}
/**
* Get the database manager instance.
*
* @return DatabaseManager
*/
public function getDatabaseManager()
{
return $this->manager;
}
/**
* Get the current event dispatcher instance.
*
* @return EventDispatcherInterface|null
*/
public function getEventDispatcher()
{
if ($this->container->has(EventDispatcherInterface::class)) {
return $this->container->get(EventDispatcherInterface::class);
}
}
/**
* Set the event dispatcher instance to be used by connections.
*
* @param \Psr\EventDispatcher\EventDispatcherInterface $dispatcher
* @return void
*/
public function setEventDispatcher(Dispatcher $dispatcher)
{
$this->container->set(EventDispatcherInterface::class, $dispatcher);
}
/**
* Dynamically pass methods to the default connection.
*
* @param string $method
* @param array $parameters
* @return mixed
*/
public static function __callStatic($method, $parameters)
{
return static::connection()->$method(...$parameters);
}
}

View File

@ -3,7 +3,7 @@
namespace HyperfTest\Database;
use PHPUnit\Framework\TestCase;
use Illuminate\Database\Concerns\BuildsQueries;
use Hyperf\Database\Concerns\BuildsQueries;
class DatabaseConcernsBuildsQueriesTraitTest extends TestCase
{

View File

@ -6,9 +6,9 @@ use PDO;
use Mockery as m;
use ReflectionProperty;
use PHPUnit\Framework\TestCase;
use Illuminate\Container\Container;
use Illuminate\Database\Capsule\Manager as DB;
use Illuminate\Database\Connectors\ConnectionFactory;
use Hyperf\Container\Container;
use Hyperf\Database\Capsule\Manager as DB;
use Hyperf\Database\Connectors\ConnectionFactory;
class DatabaseConnectionFactoryTest extends TestCase
{

View File

@ -11,17 +11,17 @@ use PDOStatement;
use ErrorException;
use ReflectionClass;
use PHPUnit\Framework\TestCase;
use Illuminate\Database\Connection;
use Illuminate\Database\QueryException;
use Illuminate\Database\Schema\Builder;
use Illuminate\Contracts\Events\Dispatcher;
use Illuminate\Database\Events\QueryExecuted;
use Illuminate\Database\Query\Grammars\Grammar;
use Illuminate\Database\Query\Processors\Processor;
use Illuminate\Database\Events\TransactionBeginning;
use Illuminate\Database\Events\TransactionCommitted;
use Illuminate\Database\Events\TransactionRolledBack;
use Illuminate\Database\Query\Builder as BaseBuilder;
use Hyperf\Database\Connection;
use Hyperf\Database\QueryException;
use Hyperf\Database\Schema\Builder;
use Hyperf\Contracts\Events\Dispatcher;
use Hyperf\Database\Events\QueryExecuted;
use Hyperf\Database\Query\Grammars\Grammar;
use Hyperf\Database\Query\Processors\Processor;
use Hyperf\Database\Events\TransactionBeginning;
use Hyperf\Database\Events\TransactionCommitted;
use Hyperf\Database\Events\TransactionRolledBack;
use Hyperf\Database\Query\Builder as BaseBuilder;
class DatabaseConnectionTest extends TestCase
{
@ -241,7 +241,7 @@ class DatabaseConnectionTest extends TestCase
}
/**
* @expectedException \Illuminate\Database\QueryException
* @expectedException \Hyperf\Database\QueryException
* @expectedExceptionMessage Deadlock found when trying to get lock (SQL: )
*/
public function testTransactionMethodRetriesOnDeadlock()
@ -273,7 +273,7 @@ class DatabaseConnectionTest extends TestCase
}
/**
* @expectedException \Illuminate\Database\QueryException
* @expectedException \Hyperf\Database\QueryException
* @expectedExceptionMessage server has gone away (SQL: foo)
*/
public function testOnLostConnectionPDOIsNotSwappedWithinATransaction()
@ -327,7 +327,7 @@ class DatabaseConnectionTest extends TestCase
}
/**
* @expectedException \Illuminate\Database\QueryException
* @expectedException \Hyperf\Database\QueryException
* @expectedExceptionMessage (SQL: ) (SQL: )
*/
public function testRunMethodNeverRetriesIfWithinTransaction()

View File

@ -5,11 +5,11 @@ namespace HyperfTest\Database;
use PDO;
use Mockery as m;
use PHPUnit\Framework\TestCase;
use Illuminate\Database\Connectors\Connector;
use Illuminate\Database\Connectors\MySqlConnector;
use Illuminate\Database\Connectors\SQLiteConnector;
use Illuminate\Database\Connectors\PostgresConnector;
use Illuminate\Database\Connectors\SqlServerConnector;
use Hyperf\Database\Connectors\Connector;
use Hyperf\Database\Connectors\MySqlConnector;
use Hyperf\Database\Connectors\SQLiteConnector;
use Hyperf\Database\Connectors\PostgresConnector;
use Hyperf\Database\Connectors\SqlServerConnector;
class DatabaseConnectorTest extends TestCase
{

View File

@ -3,10 +3,10 @@
namespace HyperfTest\Database;
use PHPUnit\Framework\TestCase;
use Illuminate\Database\Connection;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Capsule\Manager as DB;
use Illuminate\Database\Eloquent\Model as Eloquent;
use Hyperf\Database\Connection;
use Hyperf\Database\Model\Collection;
use Hyperf\Database\Capsule\Manager as DB;
use Hyperf\Database\Model\Model;
class DatabaseEloquentBelongsToManyChunkByIdTest extends TestCase
{
@ -99,7 +99,7 @@ class DatabaseEloquentBelongsToManyChunkByIdTest extends TestCase
*/
protected function connection()
{
return Eloquent::getConnectionResolver()->connection();
return Model::getConnectionResolver()->connection();
}
/**
@ -113,7 +113,7 @@ class DatabaseEloquentBelongsToManyChunkByIdTest extends TestCase
}
}
class BelongsToManyChunkByIdTestTestUser extends Eloquent
class BelongsToManyChunkByIdTestTestUser extends Model
{
protected $table = 'users';
protected $fillable = ['id', 'email'];
@ -125,7 +125,7 @@ class BelongsToManyChunkByIdTestTestUser extends Eloquent
}
}
class BelongsToManyChunkByIdTestTestArticle extends Eloquent
class BelongsToManyChunkByIdTestTestArticle extends Model
{
protected $primaryKey = 'aid';
protected $table = 'articles';

View File

@ -3,9 +3,9 @@
namespace HyperfTest\Database;
use PHPUnit\Framework\TestCase;
use Illuminate\Database\Connection;
use Illuminate\Database\Capsule\Manager as DB;
use Illuminate\Database\Eloquent\Model as Eloquent;
use Hyperf\Database\Connection;
use Hyperf\Database\Capsule\Manager as DB;
use Hyperf\Database\Model\Model as Eloquent;
class DatabaseEloquentBelongsToManySyncReturnValueTypeTest extends TestCase
{

View File

@ -4,9 +4,9 @@ namespace HyperfTest\Database;
use Mockery as m;
use PHPUnit\Framework\TestCase;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Hyperf\Database\Model\Model;
use Hyperf\Database\Model\Builder;
use Hyperf\Database\Model\Relations\BelongsToMany;
class DatabaseEloquentBelongsToManyWithDefaultAttributesTest extends TestCase
{

View File

@ -4,10 +4,10 @@ namespace HyperfTest\Database;
use Mockery as m;
use PHPUnit\Framework\TestCase;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Hyperf\Database\Model\Model;
use Hyperf\Database\Model\Builder;
use Hyperf\Database\Model\Collection;
use Hyperf\Database\Model\Relations\BelongsTo;
class DatabaseEloquentBelongsToTest extends TestCase
{

View File

@ -6,16 +6,16 @@ use Closure;
use stdClass;
use Mockery as m;
use PHPUnit\Framework\TestCase;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\ConnectionInterface;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Query\Grammars\Grammar;
use Illuminate\Database\Query\Processors\Processor;
use Illuminate\Database\ConnectionResolverInterface;
use Illuminate\Support\Collection as BaseCollection;
use Illuminate\Database\Query\Builder as BaseBuilder;
use Hyperf\Database\Model\Model;
use Hyperf\Database\Model\Builder;
use Hyperf\Database\ConnectionInterface;
use Hyperf\Database\Model\Collection;
use Hyperf\Database\Model\SoftDeletes;
use Hyperf\Database\Query\Grammars\Grammar;
use Hyperf\Database\Query\Processors\Processor;
use Hyperf\Database\ConnectionResolverInterface;
use Hyperf\Support\Collection as BaseCollection;
use Hyperf\Database\Query\Builder as BaseBuilder;
class DatabaseEloquentBuilderTest extends TestCase
{
@ -67,7 +67,7 @@ class DatabaseEloquentBuilderTest extends TestCase
}
/**
* @expectedException \Illuminate\Database\Eloquent\ModelNotFoundException
* @expectedException \Hyperf\Database\ModelNotFoundException
*/
public function testFindOrFailMethodThrowsModelNotFoundException()
{
@ -79,7 +79,7 @@ class DatabaseEloquentBuilderTest extends TestCase
}
/**
* @expectedException \Illuminate\Database\Eloquent\ModelNotFoundException
* @expectedException \Hyperf\Database\ModelNotFoundException
*/
public function testFindOrFailMethodWithManyThrowsModelNotFoundException()
{
@ -91,7 +91,7 @@ class DatabaseEloquentBuilderTest extends TestCase
}
/**
* @expectedException \Illuminate\Database\Eloquent\ModelNotFoundException
* @expectedException \Hyperf\Database\ModelNotFoundException
*/
public function testFirstOrFailMethodThrowsModelNotFoundException()
{
@ -417,7 +417,7 @@ class DatabaseEloquentBuilderTest extends TestCase
/**
* @expectedException \BadMethodCallException
* @expectedExceptionMessage Call to undefined method Illuminate\Database\Eloquent\Builder::missingMacro()
* @expectedExceptionMessage Call to undefined method Hyperf\Database\Model\Builder::missingMacro()
*/
public function testMissingStaticMacrosThrowsProperException()
{
@ -508,7 +508,7 @@ class DatabaseEloquentBuilderTest extends TestCase
}
/**
* @expectedException \Illuminate\Database\Eloquent\RelationNotFoundException
* @expectedException \Hyperf\Database\Model\RelationNotFoundException
*/
public function testGetRelationThrowsException()
{
@ -1063,8 +1063,8 @@ class DatabaseEloquentBuilderTest extends TestCase
protected function mockConnectionForModel($model, $database)
{
$grammarClass = 'Illuminate\Database\Query\Grammars\\'.$database.'Grammar';
$processorClass = 'Illuminate\Database\Query\Processors\\'.$database.'Processor';
$grammarClass = 'Hyperf\Database\Query\Grammars\\'.$database.'Grammar';
$processorClass = 'Hyperf\Database\Query\Processors\\'.$database.'Processor';
$grammar = new $grammarClass;
$processor = new $processorClass;
$connection = m::mock(ConnectionInterface::class, ['getQueryGrammar' => $grammar, 'getPostProcessor' => $processor]);

View File

@ -4,8 +4,8 @@ namespace HyperfTest\Database;
use stdClass;
use PHPUnit\Framework\TestCase;
use Illuminate\Database\Capsule\Manager as DB;
use Illuminate\Database\Eloquent\Model as Eloquent;
use Hyperf\Database\Capsule\Manager as DB;
use Hyperf\Database\Model\Model as Eloquent;
class DatabaseEloquentCastsDatabaseStringTest extends TestCase
{
@ -94,7 +94,7 @@ class DatabaseEloquentCastsDatabaseStringTest extends TestCase
/**
* Get a database connection instance.
*
* @return \Illuminate\Database\Connection
* @return \Hyperf\Database\Connection
*/
protected function connection()
{
@ -104,7 +104,7 @@ class DatabaseEloquentCastsDatabaseStringTest extends TestCase
/**
* Get a schema builder instance.
*
* @return \Illuminate\Database\Schema\Builder
* @return \Hyperf\Database\Schema\Builder
*/
protected function schema()
{

View File

@ -4,9 +4,9 @@ namespace HyperfTest\Database;
use Mockery as m;
use PHPUnit\Framework\TestCase;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Support\Collection as BaseCollection;
use Hyperf\Database\Model\Model;
use Hyperf\Database\Model\Collection;
use Hyperf\Support\Collection as BaseCollection;
class DatabaseEloquentCollectionTest extends TestCase
{

View File

@ -4,10 +4,10 @@ namespace HyperfTest\Database;
use Mockery as m;
use PHPUnit\Framework\TestCase;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Scope;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Capsule\Manager as DB;
use Hyperf\Database\Model\Model;
use Hyperf\Database\Model\Scope;
use Hyperf\Database\Model\Builder;
use Hyperf\Database\Capsule\Manager as DB;
class DatabaseEloquentGlobalScopesTest extends TestCase
{

View File

@ -5,10 +5,10 @@ namespace HyperfTest\Database;
use stdClass;
use Mockery as m;
use PHPUnit\Framework\TestCase;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Hyperf\Database\Model\Model;
use Hyperf\Database\Model\Builder;
use Hyperf\Database\Model\Collection;
use Hyperf\Database\Model\Relations\HasMany;
class DatabaseEloquentHasManyTest extends TestCase
{

View File

@ -3,9 +3,9 @@
namespace HyperfTest\Database;
use PHPUnit\Framework\TestCase;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Capsule\Manager as DB;
use Illuminate\Database\Eloquent\Model as Eloquent;
use Hyperf\Database\Model\SoftDeletes;
use Hyperf\Database\Capsule\Manager as DB;
use Hyperf\Database\Model\Model as Eloquent;
class DatabaseEloquentHasManyThroughIntegrationTest extends TestCase
{
@ -119,7 +119,7 @@ class DatabaseEloquentHasManyThroughIntegrationTest extends TestCase
}
/**
* @expectedException \Illuminate\Database\Eloquent\ModelNotFoundException
* @expectedException \Hyperf\Database\ModelNotFoundException
* @expectedExceptionMessage No query results for model [\HyperfTest\Database\HasManyThroughTestPost].
*/
public function testFirstOrFailThrowsAnException()
@ -131,7 +131,7 @@ class DatabaseEloquentHasManyThroughIntegrationTest extends TestCase
}
/**
* @expectedException \Illuminate\Database\Eloquent\ModelNotFoundException
* @expectedException \Hyperf\Database\ModelNotFoundException
* @expectedExceptionMessage No query results for model [\HyperfTest\Database\HasManyThroughTestPost] 1
*/
public function testFindOrFailThrowsAnException()
@ -364,7 +364,7 @@ class DatabaseEloquentHasManyThroughIntegrationTest extends TestCase
/**
* Get a database connection instance.
*
* @return \Illuminate\Database\Connection
* @return \Hyperf\Database\Connection
*/
protected function connection()
{
@ -374,7 +374,7 @@ class DatabaseEloquentHasManyThroughIntegrationTest extends TestCase
/**
* Get a schema builder instance.
*
* @return \Illuminate\Database\Schema\Builder
* @return \Hyperf\Database\Schema\Builder
*/
protected function schema()
{

View File

@ -4,12 +4,12 @@ namespace HyperfTest\Database;
use Mockery as m;
use PHPUnit\Framework\TestCase;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Query\Expression;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Relations\HasOne;
use Illuminate\Database\Query\Builder as BaseBuilder;
use Hyperf\Database\Model\Model;
use Hyperf\Database\Model\Builder;
use Hyperf\Database\Query\Expression;
use Hyperf\Database\Model\Collection;
use Hyperf\Database\Model\Relations\HasOne;
use Hyperf\Database\Query\Builder as BaseBuilder;
class DatabaseEloquentHasOneTest extends TestCase
{

View File

@ -3,21 +3,21 @@
namespace HyperfTest\Database;
use Exception;
use Illuminate\Support\Carbon;
use Hyperf\Support\Carbon;
use PHPUnit\Framework\TestCase;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Capsule\Manager as DB;
use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Tests\Integration\Database\Post;
use Illuminate\Tests\Integration\Database\User;
use Illuminate\Database\Eloquent\Relations\Pivot;
use Illuminate\Database\Eloquent\Model as Eloquent;
use Illuminate\Database\Eloquent\SoftDeletingScope;
use Illuminate\Database\Eloquent\Relations\Relation;
use Illuminate\Pagination\AbstractPaginator as Paginator;
use Hyperf\Database\Model\Model;
use Hyperf\Database\Model\Builder;
use Hyperf\Database\Model\Collection;
use Hyperf\Database\Model\SoftDeletes;
use Hyperf\Database\Capsule\Manager as DB;
use Hyperf\Pagination\LengthAwarePaginator;
use Hyperf\Tests\Integration\Database\Post;
use Hyperf\Tests\Integration\Database\User;
use Hyperf\Database\Model\Relations\Pivot;
use Hyperf\Database\Model\Model as Eloquent;
use Hyperf\Database\Model\SoftDeletingScope;
use Hyperf\Database\Model\Relations\Relation;
use Hyperf\Pagination\AbstractPaginator as Paginator;
class DatabaseEloquentIntegrationTest extends TestCase
{
@ -440,7 +440,7 @@ class DatabaseEloquentIntegrationTest extends TestCase
}
/**
* @expectedException \Illuminate\Database\Eloquent\ModelNotFoundException
* @expectedException \Hyperf\Database\ModelNotFoundException
* @expectedExceptionMessage No query results for model [\HyperfTest\Database\EloquentTestUser] 1
*/
public function testFindOrFailWithSingleIdThrowsModelNotFoundException()
@ -449,7 +449,7 @@ class DatabaseEloquentIntegrationTest extends TestCase
}
/**
* @expectedException \Illuminate\Database\Eloquent\ModelNotFoundException
* @expectedException \Hyperf\Database\ModelNotFoundException
* @expectedExceptionMessage No query results for model [\HyperfTest\Database\EloquentTestUser] 1, 2
*/
public function testFindOrFailWithMultipleIdsThrowsModelNotFoundException()
@ -924,7 +924,7 @@ class DatabaseEloquentIntegrationTest extends TestCase
}
/**
* @expectedException \Illuminate\Database\QueryException
* @expectedException \Hyperf\Database\QueryException
* @expectedExceptionMessage SQLSTATE[23000]:
*/
public function testSaveOrFailWithDuplicatedEntry()
@ -1559,7 +1559,7 @@ class DatabaseEloquentIntegrationTest extends TestCase
/**
* Get a database connection instance.
*
* @return \Illuminate\Database\Connection
* @return \Hyperf\Database\Connection
*/
protected function connection($connection = 'default')
{
@ -1569,7 +1569,7 @@ class DatabaseEloquentIntegrationTest extends TestCase
/**
* Get a schema builder instance.
*
* @return \Illuminate\Database\Schema\Builder
* @return \Hyperf\Database\Schema\Builder
*/
protected function schema($connection = 'default')
{

View File

@ -3,10 +3,10 @@
namespace HyperfTest\Database;
use PHPUnit\Framework\TestCase;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Capsule\Manager as DB;
use Illuminate\Database\Eloquent\Model as Eloquent;
use Illuminate\Database\Eloquent\Relations\Relation;
use Hyperf\Database\Model\Collection;
use Hyperf\Database\Capsule\Manager as DB;
use Hyperf\Database\Model\Model as Eloquent;
use Hyperf\Database\Model\Relations\Relation;
class DatabaseEloquentIntegrationWithTablePrefixTest extends TestCase
{
@ -98,7 +98,7 @@ class DatabaseEloquentIntegrationWithTablePrefixTest extends TestCase
/**
* Get a database connection instance.
*
* @return \Illuminate\Database\Connection
* @return \Hyperf\Database\Connection
*/
protected function connection($connection = 'default')
{
@ -108,7 +108,7 @@ class DatabaseEloquentIntegrationWithTablePrefixTest extends TestCase
/**
* Get a schema builder instance.
*
* @return \Illuminate\Database\Schema\Builder
* @return \Hyperf\Database\Schema\Builder
*/
protected function schema($connection = 'default')
{

View File

@ -2,28 +2,29 @@
namespace HyperfTest\Database;
use Carbon\Carbon;
use DateTime;
use Hyperf\Database\ConnectionInterface;
use stdClass;
use Exception;
use Mockery as m;
use ReflectionClass;
use DateTimeImmutable;
use DateTimeInterface;
use Illuminate\Support\Carbon;
use PHPUnit\Framework\TestCase;
use Illuminate\Database\Connection;
use Illuminate\Database\Eloquent\Model;
use Hyperf\Database\Connection;
use Hyperf\Database\Model\Model;
use HyperfTest\Database\EloquentModelNamespacedStub;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\InteractsWithTime;
use Illuminate\Contracts\Events\Dispatcher;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Query\Grammars\Grammar;
use Illuminate\Database\Query\Processors\Processor;
use Illuminate\Database\ConnectionResolverInterface;
use Illuminate\Database\Eloquent\Relations\Relation;
use Illuminate\Support\Collection as BaseCollection;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Hyperf\Database\Model\Builder;
use Hyperf\Utils\InteractsWithTime;
use Hyperf\Contracts\Events\Dispatcher;
use Hyperf\Database\Model\Collection;
use Hyperf\Database\Query\Grammars\Grammar;
use Hyperf\Database\Query\Processors\Processor;
use Hyperf\Database\ConnectionResolverInterface;
use Hyperf\Database\Model\Relations\Relation;
use Hyperf\Utils\Collection as BaseCollection;
use Hyperf\Database\Model\Relations\BelongsTo;
class DatabaseEloquentModelTest extends TestCase
{
@ -963,7 +964,7 @@ class DatabaseEloquentModelTest extends TestCase
}
/**
* @expectedException \Illuminate\Database\Eloquent\MassAssignmentException
* @expectedException \Hyperf\Database\Model\MassAssignmentException
* @expectedExceptionMessage name
*/
public function testGlobalGuarded()
@ -1622,7 +1623,7 @@ class DatabaseEloquentModelTest extends TestCase
}
/**
* @expectedException \Illuminate\Database\Eloquent\JsonEncodingException
* @expectedException \Hyperf\Database\Model\JsonEncodingException
* @expectedExceptionMessage Unable to encode attribute [objectAttribute] for model [\HyperfTest\Database\EloquentModelCastingStub] to JSON: Malformed UTF-8 characters, possibly incorrectly encoded.
*/
public function testModelAttributeCastingFailsOnUnencodableData()
@ -1982,7 +1983,7 @@ class EloquentModelSaveStub extends Model
$this->incrementing = $value;
}
public function getConnection()
public function getConnection():ConnectionInterface
{
$mock = m::mock(Connection::class);
$mock->shouldReceive('getQueryGrammar')->andReturn(m::mock(Grammar::class));
@ -2030,7 +2031,7 @@ class EloquentModelHydrateRawStub extends Model
return 'hydrated';
}
public function getConnection()
public function getConnection():ConnectionInterface
{
$mock = m::mock(Connection::class);
$mock->shouldReceive('select')->once()->with('SELECT ?', ['foo'])->andReturn([]);

View File

@ -4,12 +4,12 @@ namespace HyperfTest\Database;
use Mockery as m;
use PHPUnit\Framework\TestCase;
use Illuminate\Database\Eloquent\Model;
use Hyperf\Database\Model\Model;
use HyperfTest\Database\EloquentModelNamespacedStub;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Relations\MorphOne;
use Illuminate\Database\Eloquent\Relations\Relation;
use Illuminate\Database\Eloquent\Relations\MorphMany;
use Hyperf\Database\Model\Builder;
use Hyperf\Database\Model\Relations\MorphOne;
use Hyperf\Database\Model\Relations\Relation;
use Hyperf\Database\Model\Relations\MorphMany;
class DatabaseEloquentMorphTest extends TestCase
{

View File

@ -4,9 +4,9 @@ namespace HyperfTest\Database;
use Mockery as m;
use PHPUnit\Framework\TestCase;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Relations\MorphToMany;
use Hyperf\Database\Model\Model;
use Hyperf\Database\Model\Builder;
use Hyperf\Database\Model\Relations\MorphToMany;
class DatabaseEloquentMorphToManyTest extends TestCase
{

View File

@ -4,9 +4,9 @@ namespace HyperfTest\Database;
use Mockery as m;
use PHPUnit\Framework\TestCase;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Relations\MorphTo;
use Hyperf\Database\Model\Model;
use Hyperf\Database\Model\Builder;
use Hyperf\Database\Model\Relations\MorphTo;
class DatabaseEloquentMorphToTest extends TestCase
{

View File

@ -4,8 +4,8 @@ namespace HyperfTest\Database;
use Mockery as m;
use PHPUnit\Framework\TestCase;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\Pivot;
use Hyperf\Database\Model\Model;
use Hyperf\Database\Model\Relations\Pivot;
class DatabaseEloquentPivotTest extends TestCase
{

View File

@ -3,8 +3,8 @@
namespace HyperfTest\Database;
use PHPUnit\Framework\TestCase;
use Illuminate\Database\Capsule\Manager as DB;
use Illuminate\Database\Eloquent\Model as Eloquent;
use Hyperf\Database\Capsule\Manager as DB;
use Hyperf\Database\Model\Model as Eloquent;
class DatabaseEloquentPolymorphicIntegrationTest extends TestCase
{
@ -152,7 +152,7 @@ class DatabaseEloquentPolymorphicIntegrationTest extends TestCase
/**
* Get a database connection instance.
*
* @return \Illuminate\Database\Connection
* @return \Hyperf\Database\Connection
*/
protected function connection()
{
@ -162,7 +162,7 @@ class DatabaseEloquentPolymorphicIntegrationTest extends TestCase
/**
* Get a schema builder instance.
*
* @return \Illuminate\Database\Schema\Builder
* @return \Hyperf\Database\Schema\Builder
*/
protected function schema()
{

View File

@ -3,9 +3,9 @@
namespace HyperfTest\Database;
use PHPUnit\Framework\TestCase;
use Illuminate\Database\Capsule\Manager as DB;
use Illuminate\Database\Eloquent\Model as Eloquent;
use Illuminate\Database\Eloquent\Relations\Relation;
use Hyperf\Database\Capsule\Manager as DB;
use Hyperf\Database\Model\Model as Eloquent;
use Hyperf\Database\Model\Relations\Relation;
class DatabaseEloquentPolymorphicRelationsIntegrationTest extends TestCase
{
@ -131,7 +131,7 @@ class DatabaseEloquentPolymorphicRelationsIntegrationTest extends TestCase
/**
* Get a database connection instance.
*
* @return \Illuminate\Database\Connection
* @return \Hyperf\Database\Connection
*/
protected function connection($connection = 'default')
{
@ -141,7 +141,7 @@ class DatabaseEloquentPolymorphicRelationsIntegrationTest extends TestCase
/**
* Get a schema builder instance.
*
* @return \Illuminate\Database\Schema\Builder
* @return \Hyperf\Database\Schema\Builder
*/
protected function schema($connection = 'default')
{

View File

@ -4,13 +4,13 @@ namespace HyperfTest\Database;
use Exception;
use Mockery as m;
use Illuminate\Support\Carbon;
use Hyperf\Support\Carbon;
use PHPUnit\Framework\TestCase;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Relations\HasOne;
use Illuminate\Database\Eloquent\Relations\Relation;
use Hyperf\Database\Model\Model;
use Hyperf\Database\Model\Builder;
use Hyperf\Database\Model\Collection;
use Hyperf\Database\Model\Relations\HasOne;
use Hyperf\Database\Model\Relations\Relation;
class DatabaseEloquentRelationTest extends TestCase
{

View File

@ -2,14 +2,14 @@
namespace HyperfTest\Database;
use Illuminate\Support\Carbon;
use Hyperf\Support\Carbon;
use PHPUnit\Framework\TestCase;
use Illuminate\Pagination\Paginator;
use Illuminate\Database\Query\Builder;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Capsule\Manager as DB;
use Illuminate\Database\Eloquent\Model as Eloquent;
use Illuminate\Database\Eloquent\SoftDeletingScope;
use Hyperf\Pagination\Paginator;
use Hyperf\Database\Query\Builder;
use Hyperf\Database\Model\SoftDeletes;
use Hyperf\Database\Capsule\Manager as DB;
use Hyperf\Database\Model\Model as Eloquent;
use Hyperf\Database\Model\SoftDeletingScope;
class DatabaseEloquentSoftDeletesIntegrationTest extends TestCase
{
@ -717,7 +717,7 @@ class DatabaseEloquentSoftDeletesIntegrationTest extends TestCase
/**
* Get a database connection instance.
*
* @return \Illuminate\Database\Connection
* @return \Hyperf\Database\Connection
*/
protected function connection()
{
@ -727,7 +727,7 @@ class DatabaseEloquentSoftDeletesIntegrationTest extends TestCase
/**
* Get a schema builder instance.
*
* @return \Illuminate\Database\Schema\Builder
* @return \Hyperf\Database\Schema\Builder
*/
protected function schema()
{

View File

@ -2,10 +2,10 @@
namespace HyperfTest\Database;
use Illuminate\Support\Carbon;
use Hyperf\Support\Carbon;
use PHPUnit\Framework\TestCase;
use Illuminate\Database\Capsule\Manager as DB;
use Illuminate\Database\Eloquent\Model as Eloquent;
use Hyperf\Database\Capsule\Manager as DB;
use Hyperf\Database\Model\Model as Eloquent;
class DatabaseEloquentTimestampsTest extends TestCase
{
@ -100,7 +100,7 @@ class DatabaseEloquentTimestampsTest extends TestCase
/**
* Get a database connection instance.
*
* @return \Illuminate\Database\Connection
* @return \Hyperf\Database\Connection
*/
protected function connection()
{
@ -110,7 +110,7 @@ class DatabaseEloquentTimestampsTest extends TestCase
/**
* Get a schema builder instance.
*
* @return \Illuminate\Database\Schema\Builder
* @return \Hyperf\Database\Schema\Builder
*/
protected function schema()
{

View File

@ -4,8 +4,8 @@ namespace HyperfTest\Database;
use Mockery as m;
use PHPUnit\Framework\TestCase;
use Illuminate\Filesystem\Filesystem;
use Illuminate\Database\Migrations\MigrationCreator;
use Hyperf\Filesystem\Filesystem;
use Hyperf\Database\Migrations\MigrationCreator;
class DatabaseMigrationCreatorTest extends TestCase
{

View File

@ -4,11 +4,11 @@ namespace HyperfTest\Database;
use Mockery as m;
use PHPUnit\Framework\TestCase;
use Illuminate\Foundation\Application;
use Hyperf\Foundation\Application;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\NullOutput;
use Illuminate\Database\Console\Migrations\InstallCommand;
use Illuminate\Database\Migrations\MigrationRepositoryInterface;
use Hyperf\Database\Console\Migrations\InstallCommand;
use Hyperf\Database\Migrations\MigrationRepositoryInterface;
class DatabaseMigrationInstallCommandTest extends TestCase
{

View File

@ -4,12 +4,12 @@ namespace HyperfTest\Database;
use Mockery as m;
use PHPUnit\Framework\TestCase;
use Illuminate\Support\Composer;
use Illuminate\Foundation\Application;
use Hyperf\Support\Composer;
use Hyperf\Foundation\Application;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\NullOutput;
use Illuminate\Database\Migrations\MigrationCreator;
use Illuminate\Database\Console\Migrations\MigrateMakeCommand;
use Hyperf\Database\Migrations\MigrationCreator;
use Hyperf\Database\Console\Migrations\MigrateMakeCommand;
class DatabaseMigrationMakeCommandTest extends TestCase
{

View File

@ -4,11 +4,11 @@ namespace HyperfTest\Database;
use Mockery as m;
use PHPUnit\Framework\TestCase;
use Illuminate\Foundation\Application;
use Illuminate\Database\Migrations\Migrator;
use Hyperf\Foundation\Application;
use Hyperf\Database\Migrations\Migrator;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\NullOutput;
use Illuminate\Database\Console\Migrations\MigrateCommand;
use Hyperf\Database\Console\Migrations\MigrateCommand;
class DatabaseMigrationMigrateCommandTest extends TestCase
{

View File

@ -4,14 +4,14 @@ namespace HyperfTest\Database;
use Mockery as m;
use PHPUnit\Framework\TestCase;
use Illuminate\Foundation\Application;
use Illuminate\Database\Migrations\Migrator;
use Hyperf\Foundation\Application;
use Hyperf\Database\Migrations\Migrator;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\NullOutput;
use Illuminate\Database\Console\Migrations\ResetCommand;
use Illuminate\Database\Console\Migrations\MigrateCommand;
use Illuminate\Database\Console\Migrations\RefreshCommand;
use Illuminate\Database\Console\Migrations\RollbackCommand;
use Hyperf\Database\Console\Migrations\ResetCommand;
use Hyperf\Database\Console\Migrations\MigrateCommand;
use Hyperf\Database\Console\Migrations\RefreshCommand;
use Hyperf\Database\Console\Migrations\RollbackCommand;
use Symfony\Component\Console\Application as ConsoleApplication;
class DatabaseMigrationRefreshCommandTest extends TestCase

View File

@ -6,10 +6,10 @@ use Closure;
use stdClass;
use Mockery as m;
use PHPUnit\Framework\TestCase;
use Illuminate\Support\Collection;
use Illuminate\Database\Connection;
use Illuminate\Database\ConnectionResolverInterface;
use Illuminate\Database\Migrations\DatabaseMigrationRepository;
use Hyperf\Support\Collection;
use Hyperf\Database\Connection;
use Hyperf\Database\ConnectionResolverInterface;
use Hyperf\Database\Migrations\DatabaseMigrationRepository;
class DatabaseMigrationRepositoryTest extends TestCase
{

View File

@ -4,11 +4,11 @@ namespace HyperfTest\Database;
use Mockery as m;
use PHPUnit\Framework\TestCase;
use Illuminate\Foundation\Application;
use Illuminate\Database\Migrations\Migrator;
use Hyperf\Foundation\Application;
use Hyperf\Database\Migrations\Migrator;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\NullOutput;
use Illuminate\Database\Console\Migrations\ResetCommand;
use Hyperf\Database\Console\Migrations\ResetCommand;
class DatabaseMigrationResetCommandTest extends TestCase
{

View File

@ -4,11 +4,11 @@ namespace HyperfTest\Database;
use Mockery as m;
use PHPUnit\Framework\TestCase;
use Illuminate\Foundation\Application;
use Illuminate\Database\Migrations\Migrator;
use Hyperf\Foundation\Application;
use Hyperf\Database\Migrations\Migrator;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\NullOutput;
use Illuminate\Database\Console\Migrations\RollbackCommand;
use Hyperf\Database\Console\Migrations\RollbackCommand;
class DatabaseMigrationRollbackCommandTest extends TestCase
{

View File

@ -3,15 +3,15 @@
namespace HyperfTest\Database;
use Mockery as m;
use Illuminate\Support\Str;
use Hyperf\Support\Str;
use PHPUnit\Framework\TestCase;
use Illuminate\Console\OutputStyle;
use Illuminate\Container\Container;
use Illuminate\Filesystem\Filesystem;
use Illuminate\Support\Facades\Facade;
use Illuminate\Database\Migrations\Migrator;
use Illuminate\Database\Capsule\Manager as DB;
use Illuminate\Database\Migrations\DatabaseMigrationRepository;
use Hyperf\Console\OutputStyle;
use Hyperf\Container\Container;
use Hyperf\Filesystem\Filesystem;
use Hyperf\Support\Facades\Facade;
use Hyperf\Database\Migrations\Migrator;
use Hyperf\Database\Capsule\Manager as DB;
use Hyperf\Database\Migrations\DatabaseMigrationRepository;
class DatabaseMigratorIntegrationTest extends TestCase
{

View File

@ -3,7 +3,7 @@
namespace HyperfTest\Database;
use PHPUnit\Framework\TestCase;
use Illuminate\Database\Query\Processors\MySqlProcessor;
use Hyperf\Database\Query\Processors\MySqlProcessor;
class DatabaseMySqlProcessorTest extends TestCase
{

View File

@ -4,10 +4,10 @@ namespace HyperfTest\Database;
use Mockery as m;
use PHPUnit\Framework\TestCase;
use Illuminate\Database\Connection;
use Illuminate\Database\Query\Expression;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Schema\Grammars\MySqlGrammar;
use Hyperf\Database\Connection;
use Hyperf\Database\Query\Expression;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Schema\Grammars\MySqlGrammar;
class DatabaseMySqlSchemaGrammarTest extends TestCase
{

View File

@ -3,7 +3,7 @@
namespace HyperfTest\Database;
use PHPUnit\Framework\TestCase;
use Illuminate\Database\Query\Processors\PostgresProcessor;
use Hyperf\Database\Query\Processors\PostgresProcessor;
class DatabasePostgresProcessorTest extends TestCase
{

View File

@ -4,9 +4,9 @@ namespace HyperfTest\Database;
use Mockery as m;
use PHPUnit\Framework\TestCase;
use Illuminate\Database\Connection;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Schema\Grammars\PostgresGrammar;
use Hyperf\Database\Connection;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Schema\Grammars\PostgresGrammar;
class DatabasePostgresSchemaGrammarTest extends TestCase
{

View File

@ -5,9 +5,9 @@ namespace HyperfTest\Database;
use PDO;
use Mockery as m;
use PHPUnit\Framework\TestCase;
use Illuminate\Database\Connection;
use Illuminate\Database\Query\Builder;
use Illuminate\Database\Query\Processors\Processor;
use Hyperf\Database\Connection;
use Hyperf\Database\Query\Builder;
use Hyperf\Database\Query\Processors\Processor;
class DatabaseProcessorTest extends TestCase
{

View File

@ -6,19 +6,19 @@ use stdClass;
use Mockery as m;
use InvalidArgumentException;
use PHPUnit\Framework\TestCase;
use Illuminate\Database\Query\Builder;
use Illuminate\Database\ConnectionInterface;
use Illuminate\Database\Query\Grammars\Grammar;
use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Database\Query\Expression as Raw;
use Illuminate\Database\Query\Processors\Processor;
use Illuminate\Database\Query\Grammars\MySqlGrammar;
use Illuminate\Database\Query\Grammars\SQLiteGrammar;
use Illuminate\Database\Query\Grammars\PostgresGrammar;
use Illuminate\Database\Query\Grammars\SqlServerGrammar;
use Illuminate\Database\Query\Processors\MySqlProcessor;
use Illuminate\Pagination\AbstractPaginator as Paginator;
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
use Hyperf\Database\Query\Builder;
use Hyperf\Database\ConnectionInterface;
use Hyperf\Database\Query\Grammars\Grammar;
use Hyperf\Pagination\LengthAwarePaginator;
use Hyperf\Database\Query\Expression as Raw;
use Hyperf\Database\Query\Processors\Processor;
use Hyperf\Database\Query\Grammars\MySqlGrammar;
use Hyperf\Database\Query\Grammars\SQLiteGrammar;
use Hyperf\Database\Query\Grammars\PostgresGrammar;
use Hyperf\Database\Query\Grammars\SqlServerGrammar;
use Hyperf\Database\Query\Processors\MySqlProcessor;
use Hyperf\Pagination\AbstractPaginator as Paginator;
use Hyperf\Database\Model\Builder as EloquentBuilder;
class DatabaseQueryBuilderTest extends TestCase
{

View File

@ -3,7 +3,7 @@
namespace HyperfTest\Database;
use PHPUnit\Framework\TestCase;
use Illuminate\Database\Query\Processors\SQLiteProcessor;
use Hyperf\Database\Query\Processors\SQLiteProcessor;
class DatabaseSQLiteProcessorTest extends TestCase
{

View File

@ -4,11 +4,11 @@ namespace HyperfTest\Database;
use Mockery as m;
use PHPUnit\Framework\TestCase;
use Illuminate\Database\Connection;
use Illuminate\Database\Capsule\Manager;
use Illuminate\Database\Schema\Blueprint;
use Hyperf\Database\Connection;
use Hyperf\Database\Capsule\Manager;
use Hyperf\Database\Schema\Blueprint;
use Doctrine\DBAL\Schema\SqliteSchemaManager;
use Illuminate\Database\Schema\Grammars\SQLiteGrammar;
use Hyperf\Database\Schema\Grammars\SQLiteGrammar;
class DatabaseSQLiteSchemaGrammarTest extends TestCase
{

View File

@ -3,14 +3,14 @@
namespace HyperfTest\Database;
use PHPUnit\Framework\TestCase;
use Illuminate\Container\Container;
use Illuminate\Support\Facades\Facade;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Capsule\Manager as DB;
use Illuminate\Database\Schema\Grammars\MySqlGrammar;
use Illuminate\Database\Schema\Grammars\SQLiteGrammar;
use Illuminate\Database\Schema\Grammars\PostgresGrammar;
use Illuminate\Database\Schema\Grammars\SqlServerGrammar;
use Hyperf\Container\Container;
use Hyperf\Support\Facades\Facade;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Capsule\Manager as DB;
use Hyperf\Database\Schema\Grammars\MySqlGrammar;
use Hyperf\Database\Schema\Grammars\SQLiteGrammar;
use Hyperf\Database\Schema\Grammars\PostgresGrammar;
use Hyperf\Database\Schema\Grammars\SqlServerGrammar;
class DatabaseSchemaBlueprintIntegrationTest extends TestCase
{

View File

@ -4,12 +4,12 @@ namespace HyperfTest\Database;
use Mockery as m;
use PHPUnit\Framework\TestCase;
use Illuminate\Database\Connection;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Schema\Grammars\MySqlGrammar;
use Illuminate\Database\Schema\Grammars\SQLiteGrammar;
use Illuminate\Database\Schema\Grammars\PostgresGrammar;
use Illuminate\Database\Schema\Grammars\SqlServerGrammar;
use Hyperf\Database\Connection;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Schema\Grammars\MySqlGrammar;
use Hyperf\Database\Schema\Grammars\SQLiteGrammar;
use Hyperf\Database\Schema\Grammars\PostgresGrammar;
use Hyperf\Database\Schema\Grammars\SqlServerGrammar;
class DatabaseSchemaBlueprintTest extends TestCase
{

View File

@ -3,9 +3,9 @@
namespace HyperfTest\Database;
use PHPUnit\Framework\TestCase;
use Illuminate\Container\Container;
use Illuminate\Support\Facades\Facade;
use Illuminate\Database\Capsule\Manager as DB;
use Hyperf\Container\Container;
use Hyperf\Support\Facades\Facade;
use Hyperf\Database\Capsule\Manager as DB;
class DatabaseSchemaBuilderIntegrationTest extends TestCase
{

View File

@ -5,8 +5,8 @@ namespace HyperfTest\Database;
use stdClass;
use Mockery as m;
use PHPUnit\Framework\TestCase;
use Illuminate\Database\Connection;
use Illuminate\Database\Schema\Builder;
use Hyperf\Database\Connection;
use Hyperf\Database\Schema\Builder;
class DatabaseSchemaBuilderTest extends TestCase
{

View File

@ -4,10 +4,10 @@ namespace HyperfTest\Database;
use Mockery as m;
use Mockery\Mock;
use Illuminate\Console\Command;
use Illuminate\Database\Seeder;
use Hyperf\Console\Command;
use Hyperf\Database\Seeder;
use PHPUnit\Framework\TestCase;
use Illuminate\Container\Container;
use Hyperf\Container\Container;
use Symfony\Component\Console\Output\OutputInterface;
class TestSeeder extends Seeder

View File

@ -5,13 +5,13 @@ namespace HyperfTest\Database;
use stdClass;
use Mockery as m;
use PHPUnit\Framework\TestCase;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\ConnectionInterface;
use Illuminate\Database\Query\Grammars\Grammar;
use Illuminate\Database\Eloquent\SoftDeletingScope;
use Illuminate\Database\Query\Processors\Processor;
use Illuminate\Database\Query\Builder as BaseBuilder;
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
use Hyperf\Database\Model\Model;
use Hyperf\Database\ConnectionInterface;
use Hyperf\Database\Query\Grammars\Grammar;
use Hyperf\Database\Model\SoftDeletingScope;
use Hyperf\Database\Query\Processors\Processor;
use Hyperf\Database\Query\Builder as BaseBuilder;
use Hyperf\Database\Model\Builder as EloquentBuilder;
class DatabaseSoftDeletingScopeTest extends TestCase
{

View File

@ -3,9 +3,9 @@
namespace HyperfTest\Database;
use Mockery as m;
use Illuminate\Support\Carbon;
use Hyperf\Support\Carbon;
use PHPUnit\Framework\TestCase;
use Illuminate\Database\Eloquent\SoftDeletes;
use Hyperf\Database\Model\SoftDeletes;
class DatabaseSoftDeletingTraitTest extends TestCase
{

View File

@ -4,9 +4,9 @@ namespace HyperfTest\Database;
use Mockery as m;
use PHPUnit\Framework\TestCase;
use Illuminate\Database\Connection;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Schema\Grammars\SqlServerGrammar;
use Hyperf\Database\Connection;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Schema\Grammars\SqlServerGrammar;
class DatabaseSqlServerSchemaGrammarTest extends TestCase
{

View File

@ -2,7 +2,7 @@
namespace HyperfTest\Database;
use Illuminate\Database\Eloquent\Model;
use Hyperf\Database\Model\Model;
class EloquentModelNamespacedStub extends Model
{

View File

@ -3,14 +3,14 @@
namespace HyperfTest\Database;
use Mockery as m;
use Illuminate\Database\Seeder;
use Hyperf\Database\Seeder;
use PHPUnit\Framework\TestCase;
use Illuminate\Console\OutputStyle;
use Illuminate\Container\Container;
use Hyperf\Console\OutputStyle;
use Hyperf\Container\Container;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\NullOutput;
use Illuminate\Database\Console\Seeds\SeedCommand;
use Illuminate\Database\ConnectionResolverInterface;
use Hyperf\Database\Console\Seeds\SeedCommand;
use Hyperf\Database\ConnectionResolverInterface;
class SeedCommandTest extends TestCase
{

View File

@ -3,7 +3,7 @@
namespace HyperfTest\Database;
use PHPUnit\Framework\TestCase;
use Illuminate\Database\Console\Migrations\TableGuesser;
use Hyperf\Database\Console\Migrations\TableGuesser;
class TableGuesserTest extends TestCase
{

View File

@ -1,8 +1,8 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Hyperf\Support\Facades\Schema;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration;
class CreateUsersTable extends Migration
{

View File

@ -1,8 +1,8 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Hyperf\Support\Facades\Schema;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration;
class CreatePasswordResetsTable extends Migration
{

View File

@ -1,7 +1,7 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Migrations\Migration;
use Hyperf\Support\Facades\Schema;
use Hyperf\Database\Migrations\Migration;
class CreateFlightsTable extends Migration
{