Skip to content
Prev Previous commit
Next Next commit
fix syleci
  • Loading branch information
juniohyago committed Jul 2, 2021
commit e59a8e5d720548b56b0666ff78f9fbd680bc0255
5 changes: 3 additions & 2 deletions tests/HybridRelationsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ public function testHybridWith()
$this->assertEquals($user->id, $user->books->count());
});
}

public function testHybridSync()
{
$user = new MysqlUser;
Expand Down Expand Up @@ -226,15 +227,15 @@ public function testHybridSync()
$this->assertEquals(2, $client->usersMysql->count());

// sync 2 Clients
$user->clients()->sync([$client->_id,$otherClient->_id ]);
$user->clients()->sync([$client->_id, $otherClient->_id ]);
$user = MysqlUser::find($user->id);
$this->assertEquals(2, $user->clients->count());
// Sync 1 Client
$user->clients()->sync([$client->_id]);
$user = MysqlUser::find($user->id);
$this->assertEquals(1, $user->clients->count());
// Sync 2 Clients again
$user->clients()->sync([$client->_id,$otherClient->_id ]);
$user->clients()->sync([$client->_id, $otherClient->_id ]);
$user = MysqlUser::find($user->id);
$this->assertEquals(2, $user->clients->count());
}
Expand Down
4 changes: 2 additions & 2 deletions tests/models/MysqlUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function mysqlBooks(): HasMany

public function clients()
{
return $this->belongsToMany('Client',null,'mysql_users_id','clients');
return $this->belongsToMany('Client', null, 'mysql_users_id', 'clients');
}

/**
Expand All @@ -55,7 +55,7 @@ public static function executeSchema(): void
Schema::connection('mysql')->create('client_mysql_user', function (Blueprint $table) {
$table->integer('mysql_user_id')->unsigned();
$table->string('client_id');
$table->primary(['mysql_user_id','client_id']);
$table->primary(['mysql_user_id', 'client_id']);
});
}
}
Expand Down