Skip to content

Commit

Permalink
Merge branch '6.7' into 6.13
Browse files Browse the repository at this point in the history
  • Loading branch information
andrerom committed Jul 16, 2018
2 parents e88b702 + 0e2f08f commit 3e9952c
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 20 deletions.
Expand Up @@ -22,17 +22,30 @@ protected function setUp()
parent::setUp();
}

/**
* Tests that invalid path string provided for subtree criterion result in exception.
*
* @dataProvider searchContentQueryWithInvalidDataProvider
* @expectedException \InvalidArgumentException
*/
public function testSearchContentSubtreeShouldThrowException($pathString)
{
$query = new Query(
array(
'filter' => new Criterion\Subtree($pathString),
)
);

$result = $this->getRepository()->getSearchService()->findContent($query);
}

/**
* Tests that path string provided for subtree criterion is valid.
*
* @dataProvider searchContentQueryProvider
*/
public function testSearchContentSubtree($pathString, $expectedException = null)
public function testSearchContentSubtree($pathString)
{
if ($expectedException) {
$this->setExpectedException($expectedException);
}

$query = new Query(
array(
'filter' => new Criterion\Subtree($pathString),
Expand All @@ -47,27 +60,27 @@ public function searchContentQueryProvider()
return array(
array(
'/1/2/',
null,
),
array(
array('/1/2/', '/1/2/4/'),
null,
),
array(
'/1/2',
'InvalidArgumentException',
'/1/id0/',
),
);
}

public function searchContentQueryWithInvalidDataProvider()
{
return array(
array(
array('/1/2/', '/1/2/4'),
'InvalidArgumentException',
'/1/2',
),
array(
'/1/id0/',
null,
array('/1/2/', '/1/2/4'),
),
array(
'/1/id0',
'InvalidArgumentException',
),
);
}
Expand Down
4 changes: 2 additions & 2 deletions Repository/Tests/SetupFactory/Legacy.php
Expand Up @@ -259,10 +259,10 @@ protected function clearInternalCaches()
$contentTypeHandler->clearCache();
}

/** @var $decorator \eZ\Publish\Core\Persistence\Cache\Tests\Helpers\IntegrationTestCacheServiceDecorator */
/** @var \eZ\Publish\Core\Persistence\Cache\CacheServiceDecorator $decorator */
$decorator = $this->getServiceContainer()->get('ezpublish.cache_pool.spi.cache.decorator');

$decorator->clearAllTestData();
$decorator->clear();
}

/**
Expand Down
Expand Up @@ -31,6 +31,8 @@ class ObjectStateLimitationTest extends BaseLimitationTest
* @see eZ\Publish\API\Repository\Values\User\Limitation\ObjectStateLimitation
*
* @throws \ErrorException
*
* @expectedException \eZ\Publish\API\Repository\Exceptions\NotFoundException
*/
public function testObjectStateLimitationAllow()
{
Expand Down Expand Up @@ -84,7 +86,6 @@ public function testObjectStateLimitationAllow()
$contentService->deleteContent($draft->contentInfo);
/* END: Use Case */

$this->setExpectedException('\\eZ\\Publish\\API\\Repository\\Exceptions\\NotFoundException');
$contentService->loadContent($draft->id);
}

Expand Down
Expand Up @@ -27,6 +27,8 @@ class OwnerLimitationTest extends BaseLimitationTest
* @see \eZ\Publish\API\Repository\Values\User\Limitation\OwnerLimitation
*
* @throws \ErrorException
*
* @expectedException \eZ\Publish\API\Repository\Exceptions\NotFoundException
*/
public function testOwnerLimitationAllow()
{
Expand Down Expand Up @@ -82,9 +84,6 @@ public function testOwnerLimitationAllow()
);
/* END: Use Case */

$this->setExpectedException(
'\\eZ\\Publish\\API\\Repository\\Exceptions\\NotFoundException'
);
$contentService->loadContent($content->id);
}

Expand Down

0 comments on commit 3e9952c

Please sign in to comment.