Symfony 4.0 updates (#483)
* Upd: Add Symfony 4 Compatibility #SymfonyConHackday2017 * Upd: Configure visibility of services for SF4 * Updated composer to allow Symfony 4.0 * Updated composer to allow Symfony 4.0 * PropelBundle for Symfony 4 * Upd: Travis configuration * Upd: PHP 5 not supported anymore by PHPUnit * Upd: Removing old SF version + PHPUnit correction * * Removed param that was removed in symfony/yaml afb873f * Updated format of object dumping as deprecated tags using colon symfony/yaml 38d3087 * * Added commands to console.xml as symfony no longer auto registers bundle commands * Updated two services to public * * Removed deprecated getMock calls for new createMock calls. * * Add stub for additional abstract method * * Updated schema locator test * reverted unnecessary changes to abstract command and schemal locator * Added fixtures for schema testing. * * Updated schema locator test * reverted unnecessary changes to abstract command and schemal locator * Added fixtures for schema testing. * * Removed unnecessary default for services * Updated readme to reflect symfony version support
This commit is contained in:
parent
af88d81d9a
commit
ea6a359272
25 changed files with 266 additions and 78 deletions
19
.travis.yml
19
.travis.yml
|
|
@ -3,33 +3,26 @@ sudo: false
|
|||
language: php
|
||||
|
||||
php:
|
||||
- 5.5
|
||||
- 5.6
|
||||
- 7.0
|
||||
- nightly
|
||||
- hhvm
|
||||
- 7.1
|
||||
- 7.2
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.composer/cache/files
|
||||
|
||||
env:
|
||||
- SYMFONY_VERSION="^2.8"
|
||||
- SYMFONY_VERSION="^2.8" COMPOSER_FLAGS="--prefer-lowest"
|
||||
- SYMFONY_VERSION="^3.0"
|
||||
- SYMFONY_VERSION="^3.0" COMPOSER_FLAGS="--prefer-lowest"
|
||||
- SYMFONY_VERSION="dev-master"
|
||||
- SYMFONY_VERSION="^4.0"
|
||||
|
||||
matrix:
|
||||
fast_finish: true
|
||||
|
||||
allow_failures:
|
||||
- php: hhvm
|
||||
- php: nightly
|
||||
- env: SYMFONY_VERSION="dev-master"
|
||||
exclude:
|
||||
- php: 7.0
|
||||
env: SYMFONY_VERSION="^4.0"
|
||||
|
||||
before_install:
|
||||
- phpenv config-rm xdebug.ini
|
||||
- composer self-update
|
||||
- if [ "${SYMFONY_VERSION}" != "" ]; then composer require --no-update "symfony/symfony:${SYMFONY_VERSION}"; fi;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,11 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
/**
|
||||
* This file is part of the PropelBundle package.
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @license MIT License
|
||||
*/
|
||||
|
||||
namespace Propel\Bundle\PropelBundle\DataCollector;
|
||||
|
|
@ -105,4 +104,12 @@ class PropelDataCollector extends DataCollector
|
|||
{
|
||||
return count($this->logger->getQueries());
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function reset()
|
||||
{
|
||||
// TODO: Implement reset() method.
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@ class YamlDataDumper extends AbstractDataDumper
|
|||
$data,
|
||||
$inline = 3,
|
||||
$indent = 4,
|
||||
$exceptionOnInvalidType = false,
|
||||
$objectSupport = true
|
||||
Yaml::DUMP_OBJECT
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ class PropelExtension extends Extension
|
|||
$loader->load('propel.xml');
|
||||
$loader->load('converters.xml');
|
||||
$loader->load('security.xml');
|
||||
$loader->load('console.xml');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
PropelBundle
|
||||
============
|
||||
|
||||
[](https://travis-ci.org/propelorm/PropelBundle)
|
||||
[](https://travis-ci.org/propelorm/PropelBundle)
|
||||
|
||||
This is the official implementation of [Propel](http://www.propelorm.org/) in Symfony.
|
||||
|
||||
|
|
@ -14,6 +14,7 @@ As `Propel2` will be released in the near future, we are migrating the branching
|
|||
* The `1.2` branch contains Propel *1.6* integration for Symfony *2.2* (*currently master branch*).
|
||||
* The `2.0` branch contains `Propel2` integration for Symfony *2.5-2.8*.
|
||||
* The `3.0` branch contains `Propel2` integration for Symfony *2.8-3.x*.
|
||||
* The `4.0` branch contains `Propel2` integration for Symfony *3.4-4.x*.
|
||||
|
||||
## Features
|
||||
|
||||
|
|
|
|||
78
Resources/config/console.xml
Normal file
78
Resources/config/console.xml
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
<?xml version="1.0" ?>
|
||||
|
||||
<container xmlns="http://symfony.com/schema/dic/services"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
|
||||
<services>
|
||||
<service id="propel_bundle_propel.command.acl_init_command" class="Propel\Bundle\PropelBundle\Command\AclInitCommand">
|
||||
<tag name="console.command" command="propel:acl:init" />
|
||||
</service>
|
||||
<service id="propel_bundle_propel.command.build_command" class="Propel\Bundle\PropelBundle\Command\BuildCommand">
|
||||
<tag name="console.command" command="propel:build" />
|
||||
</service>
|
||||
<service id="propel_bundle_propel.command.database_create_command" class="Propel\Bundle\PropelBundle\Command\DatabaseCreateCommand">
|
||||
<tag name="console.command" command="propel:database:create" />
|
||||
</service>
|
||||
<service class="Propel\Bundle\PropelBundle\Command\DatabaseDropCommand"
|
||||
id="propel_bundle_propel.command.database_drop_command">
|
||||
<tag name="console.command" command="propel:database:drop"/>
|
||||
</service>
|
||||
<service class="Propel\Bundle\PropelBundle\Command\DatabaseReverseCommand"
|
||||
id="propel_bundle_propel.command.database_reverse_command">
|
||||
<tag name="console.command" command="propel:database:reverse"/>
|
||||
</service>
|
||||
<service class="Propel\Bundle\PropelBundle\Command\FixturesDumpCommand"
|
||||
id="propel_bundle_propel.command.fixtures_dump_command">
|
||||
<tag name="console.command" command="propel:fixtures:dump"/>
|
||||
</service>
|
||||
<service class="Propel\Bundle\PropelBundle\Command\FixturesLoadCommand"
|
||||
id="propel_bundle_propel.command.fixtures_load_command">
|
||||
<tag name="console.command" command="propel:fixtures:load"/>
|
||||
</service>
|
||||
<service class="Propel\Bundle\PropelBundle\Command\FormGenerateCommand"
|
||||
id="propel_bundle_propel.command.form_generate_command">
|
||||
<tag name="console.command" command="propel:form:generate"/>
|
||||
</service>
|
||||
<service class="Propel\Bundle\PropelBundle\Command\GraphvizGenerateCommand"
|
||||
id="propel_bundle_propel.command.graphviz_generate_command">
|
||||
<tag name="console.command" command="propel:graphviz:generate"/>
|
||||
</service>
|
||||
<service class="Propel\Bundle\PropelBundle\Command\MigrationDiffCommand"
|
||||
id="propel_bundle_propel.command.migration_diff_command">
|
||||
<tag name="console.command" command="propel:migration:diff"/>
|
||||
</service>
|
||||
<service class="Propel\Bundle\PropelBundle\Command\MigrationDownCommand"
|
||||
id="propel_bundle_propel.command.migration_down_command">
|
||||
<tag name="console.command" command="propel:migration:down"/>
|
||||
</service>
|
||||
<service class="Propel\Bundle\PropelBundle\Command\MigrationMigrateCommand"
|
||||
id="propel_bundle_propel.command.migration_migrate_command">
|
||||
<tag name="console.command" command="propel:migration:migrate"/>
|
||||
</service>
|
||||
<service class="Propel\Bundle\PropelBundle\Command\MigrationStatusCommand"
|
||||
id="propel_bundle_propel.command.migration_status_command">
|
||||
<tag name="console.command" command="propel:migration:status"/>
|
||||
</service>
|
||||
<service class="Propel\Bundle\PropelBundle\Command\MigrationUpCommand"
|
||||
id="propel_bundle_propel.command.migration_up_command">
|
||||
<tag name="console.command" command="propel:migration:up"/>
|
||||
</service>
|
||||
<service class="Propel\Bundle\PropelBundle\Command\ModelBuildCommand"
|
||||
id="propel_bundle_propel.command.model_build_command">
|
||||
<tag name="console.command" command="propel:model:build"/>
|
||||
</service>
|
||||
<service class="Propel\Bundle\PropelBundle\Command\SqlBuildCommand"
|
||||
id="propel_bundle_propel.command.sql_build_command">
|
||||
<tag name="console.command" command="propel:sql:build"/>
|
||||
</service>
|
||||
<service class="Propel\Bundle\PropelBundle\Command\SqlInsertCommand"
|
||||
id="propel_bundle_propel.command.sql_insert_command">
|
||||
<tag name="console.command" command="propel:sql:insert"/>
|
||||
</service>
|
||||
<service class="Propel\Bundle\PropelBundle\Command\TableDropCommand"
|
||||
id="propel_bundle_propel.command.table_drop_command">
|
||||
<tag name="console.command" command="propel:table:drop"/>
|
||||
</service>
|
||||
</services>
|
||||
|
||||
</container>
|
||||
|
|
@ -19,12 +19,12 @@
|
|||
</parameters>
|
||||
|
||||
<services>
|
||||
<service id="propel.schema_locator" class="%propel.schema_locator.class%">
|
||||
<service id="propel.schema_locator" class="%propel.schema_locator.class%" public="true">
|
||||
<argument type="service" id="file_locator" />
|
||||
<argument>%propel.configuration%</argument>
|
||||
</service>
|
||||
|
||||
<service id="propel.logger" class="%propel.logger.class%">
|
||||
<service id="propel.logger" class="%propel.logger.class%" public="true">
|
||||
<tag name="monolog.logger" channel="propel" />
|
||||
<argument type="service" id="logger" on-invalid="null" />
|
||||
<argument type="service" id="debug.stopwatch" on-invalid="null" />
|
||||
|
|
@ -62,5 +62,7 @@
|
|||
<argument>%kernel.root_dir%</argument>
|
||||
<argument>%propel.configuration%</argument>
|
||||
</service>
|
||||
|
||||
|
||||
</services>
|
||||
</container>
|
||||
|
|
|
|||
|
|
@ -85,6 +85,6 @@ class SchemaLocator
|
|||
$schema->getRealPath()
|
||||
);
|
||||
|
||||
return sprintf('@%s/Resources/config/%s', $bundle->getName(), $schemaPath);
|
||||
return sprintf('%s/Resources/config/%s', $bundle->getName(), $schemaPath);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,17 +51,11 @@ class YamlDataDumperTest extends TestCase
|
|||
id: '1'
|
||||
name: 'An important one'
|
||||
author_id: CoolBookAuthor_1
|
||||
complementary_infos: !php/object:O:8:"stdClass":1:{s:15:"first_word_date";s:10:"2012-01-01";}
|
||||
complementary_infos: !php/object 'O:8:"stdClass":1:{s:15:"first_word_date";s:10:"2012-01-01";}'
|
||||
|
||||
YAML;
|
||||
|
||||
$result = file_get_contents($filename);
|
||||
|
||||
//yaml changed the way objects are serialized in
|
||||
// -> https://github.com/symfony/yaml/commit/d5a7902da7e5af069bb8fdcfcf029a229deb1111
|
||||
//so we need to replace old behavior with new, to get this test working in all versions
|
||||
$result = str_replace(' !!php/object', ' !php/object', $result);
|
||||
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
17
Tests/Fixtures/FakeBundle/FakeBundle.php
Normal file
17
Tests/Fixtures/FakeBundle/FakeBundle.php
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: drewbrown
|
||||
* Date: 2/2/18
|
||||
* Time: 3:32 PM
|
||||
*/
|
||||
|
||||
namespace Propel\Bundle\PropelBundle\Tests\Fixtures\FakeBundle;
|
||||
|
||||
|
||||
use Symfony\Component\HttpKernel\Bundle\Bundle;
|
||||
|
||||
class FakeBundle extends Bundle
|
||||
{
|
||||
|
||||
}
|
||||
|
|
@ -39,13 +39,13 @@ class EntryQueryTest extends AclTestCase
|
|||
|
||||
public function testFindByAclIdentityInvalidSecurityIdentity()
|
||||
{
|
||||
$this->setExpectedException('InvalidArgumentException');
|
||||
$this->expectException('InvalidArgumentException');
|
||||
EntryQuery::create()->findByAclIdentity($this->getAclObjectIdentity(), array('foo'), $this->con);
|
||||
}
|
||||
|
||||
public function testFindByAclIdentityInvalidSecurityIdentityObject()
|
||||
{
|
||||
$this->setExpectedException('InvalidArgumentException');
|
||||
$this->expectException('InvalidArgumentException');
|
||||
EntryQuery::create()->findByAclIdentity($this->getAclObjectIdentity(), array(new \stdClass()), $this->con);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,10 @@ class EntryTest extends AclTestCase
|
|||
{
|
||||
public function testToAclEntry()
|
||||
{
|
||||
$acl = $this->getMock('Propel\Bundle\PropelBundle\Security\Acl\Domain\AuditableAcl', array(), array(), '', false, false);
|
||||
$acl = $this->getMockBuilder('Propel\Bundle\PropelBundle\Security\Acl\Domain\AuditableAcl')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$entry = $this->createModelEntry();
|
||||
|
||||
$aclEntry = ModelEntry::toAclEntry($entry, $acl);
|
||||
|
|
@ -45,7 +48,9 @@ class EntryTest extends AclTestCase
|
|||
*/
|
||||
public function testToAclEntryFieldEntry()
|
||||
{
|
||||
$acl = $this->getMock('Propel\Bundle\PropelBundle\Security\Acl\Domain\AuditableAcl', array(), array(), '', false, false);
|
||||
$acl = $this->getMockBuilder('Propel\Bundle\PropelBundle\Security\Acl\Domain\AuditableAcl')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$entry = $this->createModelEntry();
|
||||
$entry->setFieldName('name');
|
||||
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ class ObjectIdentityQueryTest extends AclTestCase
|
|||
$result = ObjectIdentityQuery::create()->findChildren($objIdentity, $this->con);
|
||||
$this->assertCount(1, $result);
|
||||
$this->assertInstanceOf('Propel\Bundle\PropelBundle\Model\Acl\ObjectIdentity', $result->getFirst());
|
||||
$this->assertSame($childObjIdentity, $result->getFirst());
|
||||
$this->assertEquals($childObjIdentity, $result->getFirst());
|
||||
$this->assertSame($objIdentity, $result->getFirst()->getObjectIdentityRelatedByParentObjectIdentityId());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ class SecurityIdentityTest extends AclTestCase
|
|||
$identity->setIdentifier('invalidIdentifier');
|
||||
$identity->setUsername(true);
|
||||
|
||||
$this->setExpectedException('InvalidArgumentException');
|
||||
$this->expectException('InvalidArgumentException');
|
||||
SecurityIdentity::toAclIdentity($identity);
|
||||
}
|
||||
|
||||
|
|
@ -40,7 +40,7 @@ class SecurityIdentityTest extends AclTestCase
|
|||
$identity->setIdentifier('invalidIdentifier');
|
||||
$identity->setUsername(false);
|
||||
|
||||
$this->setExpectedException('InvalidArgumentException');
|
||||
$this->expectException('InvalidArgumentException');
|
||||
SecurityIdentity::toAclIdentity($identity);
|
||||
}
|
||||
|
||||
|
|
@ -84,9 +84,9 @@ class SecurityIdentityTest extends AclTestCase
|
|||
|
||||
public function testFromAclIdentityWithInvalid()
|
||||
{
|
||||
$secIdentity = $this->getMock('Symfony\Component\Security\Acl\Model\SecurityIdentityInterface');
|
||||
$secIdentity = $this->getMockBuilder('Symfony\Component\Security\Acl\Model\SecurityIdentityInterface')->getMock();
|
||||
|
||||
$this->setExpectedException('InvalidArgumentException');
|
||||
$this->expectException('InvalidArgumentException');
|
||||
SecurityIdentity::fromAclIdentity($secIdentity, $this->con);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ class AclProviderTest extends AclTestCase
|
|||
{
|
||||
$provider = $this->getAclProvider();
|
||||
|
||||
$this->setExpectedException('Symfony\Component\Security\Acl\Exception\AclNotFoundException', 'There is no ACL available for this object identity. Please create one using the MutableAclProvider.');
|
||||
$this->expectException('Symfony\Component\Security\Acl\Exception\AclNotFoundException', 'There is no ACL available for this object identity. Please create one using the MutableAclProvider.');
|
||||
$provider->findAcl($this->getAclObjectIdentity());
|
||||
}
|
||||
|
||||
|
|
@ -41,7 +41,7 @@ class AclProviderTest extends AclTestCase
|
|||
{
|
||||
$provider = $this->getAclProvider();
|
||||
|
||||
$this->setExpectedException('Symfony\Component\Security\Acl\Exception\AclNotFoundException', 'There is at least no ACL for this object identity and the given security identities. Try retrieving the ACL without security identity filter and add ACEs for the security identities.');
|
||||
$this->expectException('Symfony\Component\Security\Acl\Exception\AclNotFoundException', 'There is at least no ACL for this object identity and the given security identities. Try retrieving the ACL without security identity filter and add ACEs for the security identities.');
|
||||
$provider->findAcl($this->getAclObjectIdentity(), array($this->getRoleSecurityIdentity()));
|
||||
}
|
||||
|
||||
|
|
@ -74,7 +74,7 @@ class AclProviderTest extends AclTestCase
|
|||
|
||||
$this->assertTrue($acl->isGranted(array(1, 2, 4, 8, 16, 32, 64), array($this->getRoleSecurityIdentity('ROLE_USER'))));
|
||||
|
||||
$this->setExpectedException('Symfony\Component\Security\Acl\Exception\NoAceFoundException');
|
||||
$this->expectException('Symfony\Component\Security\Acl\Exception\NoAceFoundException');
|
||||
$acl->isGranted(array(128), array($this->getRoleSecurityIdentity('ROLE_USER')));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ class AclTest extends AclTestCase
|
|||
$collection = new ObjectCollection();
|
||||
$collection->setModel('Propel\Bundle\PropelBundle\Model\Acl\AclClass');
|
||||
|
||||
$this->setExpectedException('Symfony\Component\Security\Acl\Exception\Exception');
|
||||
$this->expectException('Symfony\Component\Security\Acl\Exception\Exception');
|
||||
new Acl($collection, $this->getAclObjectIdentity(), new PermissionGrantingStrategy());
|
||||
}
|
||||
|
||||
|
|
@ -138,7 +138,7 @@ class AclTest extends AclTestCase
|
|||
$aclObj = $this->getAclObjectIdentity();
|
||||
$acl = new Acl($collection, $aclObj, new PermissionGrantingStrategy());
|
||||
|
||||
$this->setExpectedException('InvalidArgumentException');
|
||||
$this->expectException('InvalidArgumentException');
|
||||
$acl->isSidLoaded('foo');
|
||||
}
|
||||
|
||||
|
|
@ -149,7 +149,7 @@ class AclTest extends AclTestCase
|
|||
|
||||
$acl = new Acl($collection, $this->getAclObjectIdentity(), new PermissionGrantingStrategy());
|
||||
|
||||
$this->setExpectedException('Symfony\Component\Security\Acl\Exception\NoAceFoundException');
|
||||
$this->expectException('Symfony\Component\Security\Acl\Exception\NoAceFoundException');
|
||||
$acl->isGranted(array(64), array($this->getRoleSecurityIdentity()));
|
||||
}
|
||||
|
||||
|
|
@ -167,7 +167,7 @@ class AclTest extends AclTestCase
|
|||
|
||||
$acl = new Acl($collection, $this->getAclObjectIdentity(), new PermissionGrantingStrategy());
|
||||
|
||||
$this->setExpectedException('Symfony\Component\Security\Acl\Exception\NoAceFoundException');
|
||||
$this->expectException('Symfony\Component\Security\Acl\Exception\NoAceFoundException');
|
||||
$acl->isGranted(array(64), array($this->getRoleSecurityIdentity('ROLE_USER')));
|
||||
}
|
||||
|
||||
|
|
@ -178,7 +178,7 @@ class AclTest extends AclTestCase
|
|||
|
||||
$acl = new Acl($collection, $this->getAclObjectIdentity(), new PermissionGrantingStrategy());
|
||||
|
||||
$this->setExpectedException('Symfony\Component\Security\Acl\Exception\NoAceFoundException');
|
||||
$this->expectException('Symfony\Component\Security\Acl\Exception\NoAceFoundException');
|
||||
$acl->isFieldGranted('name', array(64), array($this->getRoleSecurityIdentity()));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ class AuditableAclTest extends AclTestCase
|
|||
|
||||
$acl = new AuditableAcl($collection, $this->getAclObjectIdentity(), new PermissionGrantingStrategy());
|
||||
|
||||
$this->setExpectedException('OutOfBoundsException');
|
||||
$this->expectException('OutOfBoundsException');
|
||||
$acl->updateObjectAuditing(0, false, false);
|
||||
}
|
||||
|
||||
|
|
@ -51,7 +51,7 @@ class AuditableAclTest extends AclTestCase
|
|||
$collection->append($entry);
|
||||
$acl = new AuditableAcl($collection, $this->getAclObjectIdentity(), new PermissionGrantingStrategy());
|
||||
|
||||
$this->setExpectedException('InvalidArgumentException');
|
||||
$this->expectException('InvalidArgumentException');
|
||||
$acl->updateObjectFieldAuditing(0, 'foo', false, false);
|
||||
}
|
||||
|
||||
|
|
@ -70,7 +70,7 @@ class AuditableAclTest extends AclTestCase
|
|||
$collection->append($entry);
|
||||
$acl = new AuditableAcl($collection, $this->getAclObjectIdentity(), new PermissionGrantingStrategy());
|
||||
|
||||
$this->setExpectedException('InvalidArgumentException');
|
||||
$this->expectException('InvalidArgumentException');
|
||||
$acl->updateObjectAuditing(0, 'foo', 'bar');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ class MutableAclTest extends AclTestCase
|
|||
$collection = new ObjectCollection();
|
||||
$collection->setModel('Propel\Bundle\PropelBundle\Model\Acl\AclClass');
|
||||
|
||||
$this->setExpectedException('Symfony\Component\Security\Acl\Exception\Exception');
|
||||
$this->expectException('Symfony\Component\Security\Acl\Exception\Exception');
|
||||
new MutableAcl($collection, $this->getAclObjectIdentity(), new PermissionGrantingStrategy(), array(), null, false, $this->con);
|
||||
}
|
||||
|
||||
|
|
@ -68,14 +68,14 @@ class MutableAclTest extends AclTestCase
|
|||
public function testInsertAceInvalidMask()
|
||||
{
|
||||
$acl = $this->createEmptyAcl();
|
||||
$this->setExpectedException('InvalidArgumentException', 'The given mask is not valid. Please provide an integer.');
|
||||
$this->expectException('InvalidArgumentException', 'The given mask is not valid. Please provide an integer.');
|
||||
$acl->insertClassAce($this->getRoleSecurityIdentity(), 'foo');
|
||||
}
|
||||
|
||||
public function testInsertAceOutofBounds()
|
||||
{
|
||||
$acl = $this->createEmptyAcl();
|
||||
$this->setExpectedException('OutOfBoundsException', 'The index must be in the interval [0, 0].');
|
||||
$this->expectException('OutOfBoundsException', 'The index must be in the interval [0, 0].');
|
||||
$acl->insertClassAce($this->getRoleSecurityIdentity(), 64, 1);
|
||||
}
|
||||
|
||||
|
|
@ -120,7 +120,7 @@ class MutableAclTest extends AclTestCase
|
|||
public function testUpdateAceInvalidIndex()
|
||||
{
|
||||
$acl = $this->createEmptyAcl();
|
||||
$this->setExpectedException('OutOfBoundsException');
|
||||
$this->expectException('OutOfBoundsException');
|
||||
$acl->updateClassAce(0, 64);
|
||||
}
|
||||
|
||||
|
|
@ -132,7 +132,7 @@ class MutableAclTest extends AclTestCase
|
|||
$acl = $this->createEmptyAcl();
|
||||
$acl->insertClassAce($this->getRoleSecurityIdentity(), 64);
|
||||
|
||||
$this->setExpectedException('InvalidArgumentException', 'The given field "name" does not exist.');
|
||||
$this->expectException('InvalidArgumentException', 'The given field "name" does not exist.');
|
||||
$acl->updateClassFieldAce(0, 'name', 128);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ class MutableAclProviderTest extends AclTestCase
|
|||
$acl->insertObjectAce($this->getRoleSecurityIdentity(), 64);
|
||||
$this->getAclProvider()->updateAcl($acl);
|
||||
|
||||
$this->setExpectedException('Symfony\Component\Security\Acl\Exception\AclAlreadyExistsException');
|
||||
$this->expectException('Symfony\Component\Security\Acl\Exception\AclAlreadyExistsException');
|
||||
$this->getAclProvider()->createAcl($this->getAclObjectIdentity(1));
|
||||
}
|
||||
|
||||
|
|
@ -109,9 +109,9 @@ class MutableAclProviderTest extends AclTestCase
|
|||
|
||||
public function testUpdateAclInvalidAcl()
|
||||
{
|
||||
$acl = $this->getMock('Symfony\Component\Security\Acl\Model\MutableAclInterface');
|
||||
$acl = $this->getMockBuilder('Symfony\Component\Security\Acl\Model\MutableAclInterface')->getMock();
|
||||
|
||||
$this->setExpectedException('InvalidArgumentException');
|
||||
$this->expectException('InvalidArgumentException');
|
||||
$this->getAclProvider()->updateAcl($acl);
|
||||
}
|
||||
|
||||
|
|
|
|||
97
Tests/Service/SchemaLocatorTest.php
Normal file
97
Tests/Service/SchemaLocatorTest.php
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the PropelBundle package.
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @license MIT License
|
||||
*/
|
||||
|
||||
namespace Propel\Bundle\PropelBundle\Tests\Service;
|
||||
|
||||
use org\bovigo\vfs\vfsStream;
|
||||
use org\bovigo\vfs\vfsStreamDirectory;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use Propel\Bundle\PropelBundle\Service\SchemaLocator;
|
||||
use Propel\Bundle\PropelBundle\Tests\Fixtures\FakeBundle\FakeBundle;
|
||||
use Propel\Bundle\PropelBundle\Tests\TestCase;
|
||||
use Propel\Common\Config\FileLocator;
|
||||
use Symfony\Component\HttpKernel\Kernel;
|
||||
|
||||
class SchemaLocatorTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var Kernel
|
||||
*/
|
||||
private $kernelMock;
|
||||
|
||||
/**
|
||||
* @var vfsStreamDirectory
|
||||
*/
|
||||
private $root;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $configuration;
|
||||
|
||||
private $fileLocator;
|
||||
|
||||
/**
|
||||
* @var MockObject
|
||||
*/
|
||||
private $bundleMock;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$pathStructure = [
|
||||
'configuration' => [
|
||||
'directory' => [
|
||||
'schema.xml' => 'Schema from configuration'
|
||||
]
|
||||
],
|
||||
];
|
||||
$this->root = vfsStream::setup('projectDir');
|
||||
vfsStream::create($pathStructure);
|
||||
|
||||
$this->kernelMock = $this->getMockBuilder(Kernel::class)->disableOriginalConstructor()-> getMock();
|
||||
$this->kernelMock->method('getProjectDir')->willReturn($this->root->url());
|
||||
|
||||
$this->bundleMock = new FakeBundle();
|
||||
|
||||
$this->configuration['paths']['schemaDir'] = vfsStream::url('projectDir/configuration/directory');
|
||||
$this->fileLocator = new FileLocator(
|
||||
[
|
||||
__DIR__ . '/../Fixtures',
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
public function testLocateFromBundle()
|
||||
{
|
||||
|
||||
$locator = new SchemaLocator($this->fileLocator, $this->configuration);
|
||||
$files = $locator->locateFromBundle($this->bundleMock);
|
||||
|
||||
$this->assertCount(1, $files);
|
||||
$this->assertTrue(isset($files[__DIR__ . '/../Fixtures/FakeBundle/Resources/config/bundle.schema.xml']));
|
||||
$this->assertEquals('bundle.schema.xml', $files[__DIR__ . '/../Fixtures/FakeBundle/Resources/config/bundle.schema.xml'][1]->getFileName());
|
||||
|
||||
}
|
||||
|
||||
public function testLocateFromBundlesAndConfiguration()
|
||||
{
|
||||
$locator = new SchemaLocator($this->fileLocator, $this->configuration);
|
||||
$files = $locator->locateFromBundlesAndConfiguration(
|
||||
[$this->bundleMock]
|
||||
);
|
||||
|
||||
$this->assertCount(2, $files);
|
||||
$this->assertTrue(isset($files[__DIR__ . '/../Fixtures/FakeBundle/Resources/config/bundle.schema.xml']));
|
||||
$this->assertEquals('bundle.schema.xml', $files[__DIR__ . '/../Fixtures/FakeBundle/Resources/config/bundle.schema.xml'][1]->getFileName());
|
||||
$this->assertTrue(isset($files['vfs://projectDir/configuration/directory/schema.xml']));
|
||||
$this->assertEquals('schema.xml', $files['vfs://projectDir/configuration/directory/schema.xml'][1]->getFileName());
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
namespace Propel\Bundle\PropelBundle\Tests;
|
||||
|
||||
use PHPUnit\Framework\TestCase as BaseTestCase;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Definition;
|
||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
|
||||
|
|
@ -17,7 +18,7 @@ use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
|
|||
/**
|
||||
* TestCase
|
||||
*/
|
||||
class TestCase extends \PHPUnit_Framework_TestCase
|
||||
class TestCase extends BaseTestCase
|
||||
{
|
||||
public function getContainer()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,7 +0,0 @@
|
|||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
if(!class_exists('Symfony\\Component\\Form\\Test\\TypeTestCase')) {
|
||||
class_alias('Symfony\\Component\\Form\\Tests\\Extension\\Core\\Type\\TypeTestCase', 'Symfony\\Component\\Form\\Test\\TypeTestCase');
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "propel/propel-bundle",
|
||||
"description": "Integration of Propel in Symfony2",
|
||||
"description": "Integration of Propel in Symfony",
|
||||
"keywords": ["propel", "orm", "persistence"],
|
||||
"type": "symfony-bundle",
|
||||
"license": "MIT",
|
||||
|
|
@ -8,22 +8,22 @@
|
|||
"name": "William Durand",
|
||||
"email": "william.durand1@gmail.com"
|
||||
}],
|
||||
|
||||
"autoload": {
|
||||
"psr-4": { "Propel\\Bundle\\PropelBundle\\": "" },
|
||||
"exclude-from-classmap": [ "Tests/" ]
|
||||
},
|
||||
|
||||
"require": {
|
||||
"propel/propel": "dev-master",
|
||||
"symfony/console": "^2.8|^3.0",
|
||||
"symfony/dependency-injection": "^2.8|^3.0",
|
||||
"symfony/framework-bundle": "^2.8|^3.0",
|
||||
"symfony/security-acl": "^2.8|^3.0"
|
||||
"symfony/console": "^2.8|^3.0|^4.0",
|
||||
"symfony/dependency-injection": "^2.8|^3.0|^4.0",
|
||||
"symfony/framework-bundle": "^2.8|^3.0|^4.0",
|
||||
"symfony/security-acl": "^2.8|^3.0|^4.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^4.8.21|^5.0.10",
|
||||
"sensio/framework-extra-bundle": "^3.0.2",
|
||||
"fzaninotto/faker": "^1.5"
|
||||
"phpunit/phpunit": "^6.0",
|
||||
"sensio/framework-extra-bundle": "^4.0",
|
||||
"symfony/form": "^2.8|^3.0|^4.0",
|
||||
"fzaninotto/faker": "^1.5",
|
||||
"mikey179/vfsStream": "^1.6"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
processIsolation="false"
|
||||
stopOnFailure="false"
|
||||
syntaxCheck="false"
|
||||
bootstrap="./Tests/bootstrap.php">
|
||||
bootstrap="vendor/autoload.php">
|
||||
<php>
|
||||
<!-- <server name="SYMFONY" value="/path/to/symfony" /> -->
|
||||
</php>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue