diff --git a/tests/ExceptionTest.php b/tests/ExceptionTest.php index 3b8ff14..213dbdb 100644 --- a/tests/ExceptionTest.php +++ b/tests/ExceptionTest.php @@ -41,14 +41,14 @@ public function testMake() { $command = $application->get('make:exception'); $command->run(new ArgvInput([ 'input', - '--name=httpError', + '--name=httpErrorTest', '--type=response' ]), ioutputer()); - $this->assertSame(true, file_exists(APP_PATH . '/Exception/HttpErrorException.php')); - $this->assertStringContainsString('extends ResponseExceptionAbstract', file_get_contents(APP_PATH . '/Exception/HttpErrorException.php')); + $this->assertSame(true, file_exists(APP_PATH . '/Exception/HttpErrorTestException.php')); + $this->assertStringContainsString('extends ResponseExceptionAbstract', file_get_contents(APP_PATH . '/Exception/HttpErrorTestException.php')); - unlink(APP_PATH . '/Exception/HttpErrorException.php'); + unlink(APP_PATH . '/Exception/HttpErrorTestException.php'); } public function setUp(): void { diff --git a/tests/Model/EventTest.php b/tests/Model/EventTest.php index 1e835ed..6904e31 100644 --- a/tests/Model/EventTest.php +++ b/tests/Model/EventTest.php @@ -44,7 +44,7 @@ public function testEvent() { */ $event = iloader()->get(EventDispatcher::class); $event->listen(SavedEvent::class, SavedListener::class); - + Schema::dropIfExists('user'); Schema::create('user', function (Blueprint $table) { $table->bigIncrements('id'); $table->timestamps(); diff --git a/tests/Model/TransactionTest.php b/tests/Model/TransactionTest.php index 47f7cc2..39f93f4 100644 --- a/tests/Model/TransactionTest.php +++ b/tests/Model/TransactionTest.php @@ -18,6 +18,7 @@ class Test1Model extends ModelAbstract { class TransactionTest extends ModelTestAbstract { public function testSimple() { + idb()->connection()->getSchemaBuilder()->dropIfExists('test'); idb()->connection()->getSchemaBuilder()->create('test', function (Blueprint $table) { $table->bigIncrements('id'); $table->timestamps(); @@ -94,6 +95,7 @@ public function testSimple() { } public function testFacade() { + Schema::dropIfExists('test'); Schema::create('test', function (Blueprint $table) { $table->bigIncrements('id'); $table->timestamps(); @@ -175,6 +177,7 @@ public function testFacade() { } public function testMulti() { + Schema::dropIfExists('test'); Schema::create('test', function (Blueprint $table) { $table->bigIncrements('id'); $table->timestamps(); @@ -243,6 +246,7 @@ public function testConnection() { $table->string('name'); }); + Schema::dropIfExists('test1'); DB::beginTransaction('sqlite_test'); $model = new Test1Model(); $model->id = 4; diff --git a/tests/ProviderTest.php b/tests/ProviderTest.php index bace728..858195f 100644 --- a/tests/ProviderTest.php +++ b/tests/ProviderTest.php @@ -69,12 +69,12 @@ public function testMake() { $command = $application->get('make:provider'); $command->run(new ArgvInput([ 'input', - '--name=test' + '--name=test1' ]), ioutputer()); - $this->assertSame(true, file_exists(APP_PATH . '/Provider/TestProvider.php')); + $this->assertSame(true, file_exists(APP_PATH . '/Provider/Test1Provider.php')); - unlink(APP_PATH . '/Provider/TestProvider.php'); + unlink(APP_PATH . '/Provider/Test1Provider.php'); } public function testRoute() { diff --git a/tests/SessionTest.php b/tests/SessionTest.php index 31ce184..4f73470 100644 --- a/tests/SessionTest.php +++ b/tests/SessionTest.php @@ -62,6 +62,9 @@ public function testUserHandler() { $config = iconfig()->getUserConfig('app'); $config['session']['handler'] = 'test'; iconfig()->setUserConfig('app', $config); + $handler = iconfig()->getUserConfig('handler'); + $handler['session']['test'] = TestHandler::class; + iconfig()->setUserConfig('handler', $handler); $session = new Session(); $sessionReflect = new \ReflectionClass($session); @@ -78,6 +81,6 @@ public function testUserHandler() { $handler = $property->getValue($session); $this->assertSame(true, $handler instanceof TestHandler); - $filesystem->deleteDirectory(APP_PATH . '/Handler/Session'); + $filesystem->delete(APP_PATH . '/Handler/Session/TestHandler.php'); } } \ No newline at end of file diff --git a/tests/Util/Handler/MakeTest.php b/tests/Util/Handler/MakeTest.php index 09faf7e..dacc313 100644 --- a/tests/Util/Handler/MakeTest.php +++ b/tests/Util/Handler/MakeTest.php @@ -21,16 +21,15 @@ public function testMakeWithName() { foreach ($this->supportTypeWithName as $type) { $command->run(new ArgvInput([ 'input', - '--name=test', + '--name=testMake', '--type=' . $type ]), ioutputer()); - $file = APP_PATH . '/Handler/' . ucfirst($type) . '/TestHandler.php'; + $file = APP_PATH . '/Handler/' . ucfirst($type) . '/TestMakeHandler.php'; $this->assertSame(true, file_exists($file)); unlink($file); - rmdir(pathinfo($file, PATHINFO_DIRNAME)); } } diff --git a/tests/Util/Handler/Session/TestHandler.php b/tests/Util/Handler/Session/TestHandler.php index c5a78fc..0d7138a 100644 --- a/tests/Util/Handler/Session/TestHandler.php +++ b/tests/Util/Handler/Session/TestHandler.php @@ -15,7 +15,7 @@ public function read($session_id) { return $this->data[$session_id]; } - public function destroy($session_id) { + public function destroy($session_id, $flag = SESSION_DESTROY) { unset($this->data[$session_id]); }