-
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
79 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
tests/phpunit/ContentImport/Importers/Attachments/TestLinking.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
namespace lloc\MslsTests\ContentImport\Importers\Attachments; | ||
|
||
use Brain\Monkey\Functions; | ||
use lloc\Msls\ContentImport\ImportCoordinates; | ||
use lloc\Msls\ContentImport\Importers\Attachments\Linking; | ||
use lloc\MslsTests\MslsUnitTestCase; | ||
|
||
class TestLinking extends MslsUnitTestCase { | ||
|
||
public function testImport(): void { | ||
$coordinates = \Mockery::mock( ImportCoordinates::class ); | ||
|
||
$this->assertEquals( array(), ( new Linking( $coordinates ) )->import( array() ) ); | ||
} | ||
|
||
public function testInfo(): void { | ||
$object = (object) array( | ||
'slug' => 'linking', | ||
'name' => 'Linking', | ||
'description' => 'Links the media attachments from the source post to the destination post; media attachments are not duplicated.', | ||
); | ||
$this->assertEquals( $object, Linking::info() ); | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
tests/phpunit/ContentImport/Importers/PostMeta/TestDuplicating.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
namespace lloc\MslsTests\ContentImport\Importers\PostMeta; | ||
|
||
use Brain\Monkey\Functions; | ||
use lloc\Msls\ContentImport\ImportCoordinates; | ||
use lloc\Msls\ContentImport\Importers\PostMeta\Duplicating; | ||
use lloc\MslsTests\MslsUnitTestCase; | ||
|
||
use function Brain\Monkey\Functions; | ||
|
||
class TestDuplicating extends MslsUnitTestCase { | ||
|
||
public function testImport(): void { | ||
Functions\expect( 'switch_to_blog' )->twice(); | ||
Functions\expect( 'get_post_custom' )->once()->andReturn( array( 88 => array( 'foo' => 'bar' ) ) ); | ||
Functions\expect( 'wp_cache_delete' )->once(); | ||
Functions\expect( 'restore_current_blog' )->once(); | ||
Functions\expect( 'delete_post_meta' )->once(); | ||
Functions\expect( 'maybe_unserialize' )->once()->andReturnFirstArg(); | ||
Functions\expect( 'add_post_meta' )->once(); | ||
|
||
$coordinates = \Mockery::mock( ImportCoordinates::class ); | ||
$coordinates->source_blog_id = 1; | ||
$coordinates->source_post_id = 42; | ||
$coordinates->dest_blog_id = 2; | ||
$coordinates->dest_post_id = 13; | ||
|
||
$this->assertEquals( array(), ( new Duplicating( $coordinates ) )->import( array() ) ); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters