![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/medad.corals.io/vendor/bkwld/cloner/tests/ |
<?php // Deps use Bkwld\Cloner\Stubs\Article; use Mockery as m; use Mockery\Adapter\Phpunit\MockeryPHPUnitIntegration; use PHPUnit\Framework\TestCase; /** * Test the trait */ class CloneableTest extends TestCase { use MockeryPHPUnitIntegration; public function testDuplicate() { m::mock('alias:App', [ 'make' => m::mock('Bkwld\Cloner\Cloner', [ 'duplicate' => m::mock('Bkwld\Cloner\Stubs\Article'), ]) ]); $article = new Article; $clone = $article->duplicate(); $this->assertInstanceOf('Bkwld\Cloner\Stubs\Article', $clone); } public function testDuplicateWithDifferentDB() { m::mock('alias:App', [ 'make' => m::mock('Bkwld\Cloner\Cloner', [ 'duplicateTo' => m::mock('Bkwld\Cloner\Stubs\Article'), ]) ]); $article = new Article; $clone = $article->duplicateTo('connection'); $this->assertInstanceOf('Bkwld\Cloner\Stubs\Article', $clone); } public function testGetRelations() { $article = new Article; $this->assertEquals(['photos', 'authors', 'ratings'], $article->getCloneableRelations()); } public function testAddRelation() { $article = new Article; $article->addCloneableRelation('test'); $this->assertContains('test', $article->getCloneableRelations()); } public function testAddDuplicateRelation() { $article = new Article; $article->addCloneableRelation('test'); $article->addCloneableRelation('test'); $this->assertEquals(['photos', 'authors', 'ratings', 'test'], $article->getCloneableRelations()); } public function testCountColumnsAreExempt() { $article = new Article; $this->assertContains('photos_count', $article->getCloneExemptAttributes()); } }