public function testIndexDefaultNames() { $blueprint = new Blueprint('users'); $blueprint->unique(array('foo', 'bar')); $commands = $blueprint->getCommands(); $this->assertEquals('users_foo_bar_unique', $commands[0]->index); $blueprint = new Blueprint('users'); $blueprint->index('foo'); $commands = $blueprint->getCommands(); $this->assertEquals('users_foo_index', $commands[0]->index); }
/** * Get all of the commands with a given name. * * @param \Illuminate\Database\Schema\Blueprint $blueprint * @param string $name * @return array */ protected function getCommandsByName(Blueprint $blueprint, $name) { return array_filter($blueprint->getCommands(), function ($value) use($name) { return $value->name == $name; }); }