Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Symfony 4.0 updates #483

Merged
merged 18 commits into from
Feb 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 6 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
17 changes: 12 additions & 5 deletions DataCollector/PropelDataCollector.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <[email protected]>
*
/**
* 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;
Expand Down Expand Up @@ -105,4 +104,12 @@ private function countQueries()
{
return count($this->logger->getQueries());
}

/**
* @inheritdoc
*/
public function reset()
{
// TODO: Implement reset() method.
}
}
3 changes: 1 addition & 2 deletions DataFixtures/Dumper/YamlDataDumper.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ protected function transformArrayToData($data)
$data,
$inline = 3,
$indent = 4,
$exceptionOnInvalidType = false,
$objectSupport = true
Yaml::DUMP_OBJECT
);
}
}
1 change: 1 addition & 0 deletions DependencyInjection/PropelExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public function load(array $configs, ContainerBuilder $container)
$loader->load('propel.xml');
$loader->load('converters.xml');
$loader->load('security.xml');
$loader->load('console.xml');
}
}

Expand Down
3 changes: 2 additions & 1 deletion README.markdown
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PropelBundle
============

[![Build Status](https://travis-ci.org/propelorm/PropelBundle.svg?branch=3.0)](https://travis-ci.org/propelorm/PropelBundle)
[![Build Status](https://travis-ci.org/propelorm/PropelBundle.svg?branch=4.0)](https://travis-ci.org/propelorm/PropelBundle)

This is the official implementation of [Propel](http://www.propelorm.org/) in Symfony.

Expand All @@ -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

Expand Down
78 changes: 78 additions & 0 deletions Resources/config/console.xml
Original file line number Diff line number Diff line change
@@ -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>
6 changes: 4 additions & 2 deletions Resources/config/propel.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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" />
Expand Down Expand Up @@ -62,5 +62,7 @@
<argument>%kernel.root_dir%</argument>
<argument>%propel.configuration%</argument>
</service>


</services>
</container>
2 changes: 1 addition & 1 deletion Service/SchemaLocator.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,6 @@ protected function transformToLogicalName(\SplFileInfo $schema, BundleInterface
$schema->getRealPath()
);

return sprintf('@%s/Resources/config/%s', $bundle->getName(), $schemaPath);
return sprintf('%s/Resources/config/%s', $bundle->getName(), $schemaPath);
}
}
8 changes: 1 addition & 7 deletions Tests/DataFixtures/Dumper/YamlDataDumperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,11 @@ public function testYamlDump()
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:/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 changes: 17 additions & 0 deletions Tests/Fixtures/FakeBundle/FakeBundle.php
Original file line number Diff line number Diff line change
@@ -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
{

}
Empty file.
4 changes: 2 additions & 2 deletions Tests/Model/EntryQueryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ public function setUp()

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);
}

Expand Down
9 changes: 7 additions & 2 deletions Tests/Model/EntryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -45,7 +48,9 @@ public function testToAclEntry()
*/
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');

Expand Down
2 changes: 1 addition & 1 deletion Tests/Model/ObjectIdentityQueryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public function testFindChildren()
$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());
}

Expand Down
8 changes: 4 additions & 4 deletions Tests/Model/SecurityIdentityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function testToAclIdentityUserWithInvalidIdentifier()
$identity->setIdentifier('invalidIdentifier');
$identity->setUsername(true);

$this->setExpectedException('InvalidArgumentException');
$this->expectException('InvalidArgumentException');
SecurityIdentity::toAclIdentity($identity);
}

Expand All @@ -40,7 +40,7 @@ public function testToAclIdentityUnknownSecurityIdentity()
$identity->setIdentifier('invalidIdentifier');
$identity->setUsername(false);

$this->setExpectedException('InvalidArgumentException');
$this->expectException('InvalidArgumentException');
SecurityIdentity::toAclIdentity($identity);
}

Expand Down Expand Up @@ -84,9 +84,9 @@ public function testToAclIdentityValidRole()

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);
}

Expand Down
6 changes: 3 additions & 3 deletions Tests/Security/Acl/AclProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ public function testFindAclNoneGiven()
{
$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());
}

public function testFindAclNoneGivenFilterSecurityIdentity()
{
$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()));
}

Expand Down Expand Up @@ -74,7 +74,7 @@ public function testFindAclWithEntries()

$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')));
}

Expand Down
Loading