public function testMergeCollectionAndOverrideRoutes() { $routes1 = new RouteCollection(); $routes1->add('a1', new Route('/a1')); $routes1->add('a2', new Route('/a2')); $routes1->add('a3', new Route('/a3')); $routes2 = new RouteCollection(); $routes2->add('a1', new Route('/aaa1')); $routes2->add('b2', new Route('/b2')); $routes1->merge($routes2, true); $this->assertNull($routes1->match('/a1')); $this->assertInstanceOf(Route::class, $routes1->match('/aaa1')); $this->assertInstanceOf(Route::class, $routes1->match('/a2')); $this->assertInstanceOf(Route::class, $routes1->match('/a3')); $this->assertInstanceOf(Route::class, $routes1->match('/b2')); $this->assertCount(4, $routes1->getRoutes()); }