-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PD-13 Setup codeception and add test for events. (#3)
* PD-105 Setup codeception and add test for events. * Apply php-cs-fixer changes
- Loading branch information
1 parent
0aed427
commit 086e1f0
Showing
7 changed files
with
168 additions
and
43 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
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
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,33 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
/** | ||
* Pimcore | ||
* | ||
* This source file is available under following license: | ||
* - Pimcore Commercial License (PCL) | ||
* | ||
* @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org) | ||
* @license http://www.pimcore.org/license PCL | ||
*/ | ||
|
||
namespace Pimcore\Bundle\GenericDataIndexBundle\Tests\Unit\Event\Asset; | ||
|
||
use Codeception\Test\Unit; | ||
use Pimcore\Bundle\GenericDataIndexBundle\Event\Asset\ExtractMappingEvent; | ||
|
||
class ExtractMappingEventTest extends Unit | ||
{ | ||
public function testGetCustomFieldsMapping(): void | ||
{ | ||
$event = new ExtractMappingEvent(['test']); | ||
$this->assertSame(['test'], $event->getCustomFieldsMapping()); | ||
} | ||
|
||
public function testSetCustomFieldsMapping(): void | ||
{ | ||
$event = new ExtractMappingEvent(['test']); | ||
$event->setCustomFieldsMapping(['test2']); | ||
$this->assertSame(['test2'], $event->getCustomFieldsMapping()); | ||
} | ||
} |
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,43 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
/** | ||
* Pimcore | ||
* | ||
* This source file is available under following license: | ||
* - Pimcore Commercial License (PCL) | ||
* | ||
* @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org) | ||
* @license http://www.pimcore.org/license PCL | ||
*/ | ||
|
||
namespace Pimcore\Bundle\GenericDataIndexBundle\Tests\Unit\Event\Asset; | ||
|
||
use Codeception\Test\Unit; | ||
use Pimcore\Bundle\GenericDataIndexBundle\Event\Asset\UpdateIndexDataEvent; | ||
use Pimcore\Model\Asset; | ||
|
||
class UpdateIndexDataEventTest extends Unit | ||
{ | ||
public function testGetElement(): void | ||
{ | ||
$assetMock = $this->createMock(Asset::class); | ||
$event = new UpdateIndexDataEvent($assetMock, ['test' => 'test']); | ||
$this->assertEquals($assetMock, $event->getElement()); | ||
} | ||
|
||
public function testGetCustomFields(): void | ||
{ | ||
$assetMock = $this->createMock(Asset::class); | ||
$event = new UpdateIndexDataEvent($assetMock, ['test' => 'test']); | ||
$this->assertEquals(['test' => 'test'], $event->getCustomFields()); | ||
} | ||
|
||
public function testSetCustomFields(): void | ||
{ | ||
$assetMock = $this->createMock(Asset::class); | ||
$event = new UpdateIndexDataEvent($assetMock, ['test' => 'test']); | ||
$event->setCustomFields(['test2' => 'test2']); | ||
$this->assertEquals(['test2' => 'test2'], $event->getCustomFields()); | ||
} | ||
} |
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,43 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
/** | ||
* Pimcore | ||
* | ||
* This source file is available under following license: | ||
* - Pimcore Commercial License (PCL) | ||
* | ||
* @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org) | ||
* @license http://www.pimcore.org/license PCL | ||
*/ | ||
|
||
namespace Pimcore\Bundle\GenericDataIndexBundle\Tests\Unit\Event\DataObject; | ||
|
||
use Codeception\Test\Unit; | ||
use Pimcore\Bundle\GenericDataIndexBundle\Event\DataObject\ExtractMappingEvent; | ||
use Pimcore\Model\DataObject\ClassDefinitionInterface; | ||
|
||
class ExtractMappingEventTest extends Unit | ||
{ | ||
public function testGetCustomFieldsMapping(): void | ||
{ | ||
$classDefinition = $this->createMock(ClassDefinitionInterface::class); | ||
$event = new ExtractMappingEvent($classDefinition, ['test']); | ||
$this->assertSame(['test'], $event->getCustomFieldsMapping()); | ||
} | ||
|
||
public function testSetCustomFieldsMapping(): void | ||
{ | ||
$classDefinition = $this->createMock(ClassDefinitionInterface::class); | ||
$event = new ExtractMappingEvent($classDefinition, ['test']); | ||
$event->setCustomFieldsMapping(['test2']); | ||
$this->assertSame(['test2'], $event->getCustomFieldsMapping()); | ||
} | ||
|
||
public function testGetClassDefinition(): void | ||
{ | ||
$classDefinition = $this->createMock(ClassDefinitionInterface::class); | ||
$event = new ExtractMappingEvent($classDefinition, ['test']); | ||
$this->assertSame($classDefinition, $event->getClassDefinition()); | ||
} | ||
} |
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,43 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
/** | ||
* Pimcore | ||
* | ||
* This source file is available under following license: | ||
* - Pimcore Commercial License (PCL) | ||
* | ||
* @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org) | ||
* @license http://www.pimcore.org/license PCL | ||
*/ | ||
|
||
namespace Pimcore\Bundle\GenericDataIndexBundle\Tests\Unit\Event\DataObject; | ||
|
||
use Codeception\Test\Unit; | ||
use Pimcore\Bundle\GenericDataIndexBundle\Event\DataObject\UpdateIndexDataEvent; | ||
use Pimcore\Model\DataObject\Concrete; | ||
|
||
class UpdateIndexDataEventTest extends Unit | ||
{ | ||
public function testGetElement(): void | ||
{ | ||
$assetMock = $this->createMock(Concrete::class); | ||
$event = new UpdateIndexDataEvent($assetMock, ['test' => 'test']); | ||
$this->assertEquals($assetMock, $event->getElement()); | ||
} | ||
|
||
public function testGetCustomFields(): void | ||
{ | ||
$assetMock = $this->createMock(Concrete::class); | ||
$event = new UpdateIndexDataEvent($assetMock, ['test' => 'test']); | ||
$this->assertEquals(['test' => 'test'], $event->getCustomFields()); | ||
} | ||
|
||
public function testSetCustomFields(): void | ||
{ | ||
$assetMock = $this->createMock(Concrete::class); | ||
$event = new UpdateIndexDataEvent($assetMock, ['test' => 'test']); | ||
$event->setCustomFields(['test2' => 'test2']); | ||
$this->assertEquals(['test2' => 'test2'], $event->getCustomFields()); | ||
} | ||
} |
38 changes: 0 additions & 38 deletions
38
tests/Unit/Service/DataObject/SelectOptionsServiceTest.php
This file was deleted.
Oops, something went wrong.