Skip to content

Commit

Permalink
add a bc layer that triggers e_user_deprecated errors
Browse files Browse the repository at this point in the history
  • Loading branch information
docteurklein committed Sep 25, 2014
1 parent 289c7bd commit ac15c99
Show file tree
Hide file tree
Showing 14 changed files with 273 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/ORM/Blameable/BlameableListener.php
@@ -0,0 +1,24 @@
<?php

/**
* This file is part of the KnpDoctrineBehaviors package.
*
* (c) KnpLabs <http://knplabs.com/>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Knp\DoctrineBehaviors\ORM\Blameable;

/**
* @deprecated
*/
final class BlameableListener extends BlameableSubscriber
{
public function __construct()
{
trigger_error('use BlameableSubscriber instead.', E_USER_DEPRECATED);
call_user_func_array(array('parent', '__construct'), func_get_args());
}
}
24 changes: 24 additions & 0 deletions src/ORM/Geocodable/GeocodableListener.php
@@ -0,0 +1,24 @@
<?php

/**
* This file is part of the KnpDoctrineBehaviors package.
*
* (c) KnpLabs <http://knplabs.com/>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Knp\DoctrineBehaviors\ORM\Geocodable;

/**
* @deprecated
*/
final class GeocodableListener extends GeocodableSubscriber
{
public function __construct()
{
trigger_error('use GeocodableSubscriber instead.', E_USER_DEPRECATED);
call_user_func_array(array('parent', '__construct'), func_get_args());
}
}
24 changes: 24 additions & 0 deletions src/ORM/Loggable/LoggableListener.php
@@ -0,0 +1,24 @@
<?php

/**
* This file is part of the KnpDoctrineBehaviors package.
*
* (c) KnpLabs <http://knplabs.com/>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Knp\DoctrineBehaviors\ORM\Loggable;

/**
* @deprecated
*/
final class LoggableListener extends LoggableSubscriber
{
public function __construct()
{
trigger_error('use LoggableSubscriber instead.', E_USER_DEPRECATED);
call_user_func_array(array('parent', '__construct'), func_get_args());
}
}
24 changes: 24 additions & 0 deletions src/ORM/Sluggable/SluggableListener.php
@@ -0,0 +1,24 @@
<?php

/**
* This file is part of the KnpDoctrineBehaviors package.
*
* (c) KnpLabs <http://knplabs.com/>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Knp\DoctrineBehaviors\ORM\Sluggable;

/**
* @deprecated
*/
final class SluggableListener extends SluggableSubscriber
{
public function __construct()
{
trigger_error('use SluggableSubscriber instead.', E_USER_DEPRECATED);
call_user_func_array(array('parent', '__construct'), func_get_args());
}
}
24 changes: 24 additions & 0 deletions src/ORM/SoftDeletable/SoftDeletableListener.php
@@ -0,0 +1,24 @@
<?php

/**
* This file is part of the KnpDoctrineBehaviors package.
*
* (c) KnpLabs <http://knplabs.com/>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Knp\DoctrineBehaviors\ORM\SoftDeletable;

/**
* @deprecated
*/
final class SoftDeletableListener extends SoftDeletableSubscriber
{
public function __construct()
{
trigger_error('use SoftDeletableSubscriber instead.', E_USER_DEPRECATED);
call_user_func_array(array('parent', '__construct'), func_get_args());
}
}
24 changes: 24 additions & 0 deletions src/ORM/Timestampable/TimestampableListener.php
@@ -0,0 +1,24 @@
<?php

/**
* This file is part of the KnpDoctrineBehaviors package.
*
* (c) KnpLabs <http://knplabs.com/>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Knp\DoctrineBehaviors\ORM\Timestampable;

/**
* @deprecated
*/
final class TimestampableListener extends TimestampableSubscriber
{
public function __construct()
{
trigger_error('use TimestampableSubscriber instead.', E_USER_DEPRECATED);
call_user_func_array(array('parent', '__construct'), func_get_args());
}
}
24 changes: 24 additions & 0 deletions src/ORM/Translatable/TranslatableListener.php
@@ -0,0 +1,24 @@
<?php

/**
* This file is part of the KnpDoctrineBehaviors package.
*
* (c) KnpLabs <http://knplabs.com/>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Knp\DoctrineBehaviors\ORM\Translatable;

/**
* @deprecated
*/
final class TranslatableListener extends TranslatableSubscriber
{
public function __construct()
{
trigger_error('use TranslatableSubscriber instead.', E_USER_DEPRECATED);
call_user_func_array(array('parent', '__construct'), func_get_args());
}
}
15 changes: 15 additions & 0 deletions tests/Knp/DoctrineBehaviors/ORM/BlameableTest.php
Expand Up @@ -190,4 +190,19 @@ public function should_only_persist_user_string()
$this->assertNull($entity->getCreatedBy(), 'createdBy is a not updated because not a user entity object');
$this->assertNull($entity->getUpdatedBy(), 'updatedBy is a not updated because not a user entity object');
}

/**
* @test
* @expectedException Exception
*/
public function should_notice_deprecation()
{
set_error_handler(function() {throw new \Exception; }, E_USER_DEPRECATED);
new \Knp\DoctrineBehaviors\ORM\Blameable\BlameableListener;
}

public function tearDown()
{
restore_error_handler();
}
}
15 changes: 15 additions & 0 deletions tests/Knp/DoctrineBehaviors/ORM/GeocodableTest.php
Expand Up @@ -110,4 +110,19 @@ public function testFindByDistance()
$cities = $repo->findByDistance(new Point(47.896319, 7.352943), 6223000);
$this->assertCount(3, $cities, 'Paris, Nantes and New-York are less than 6223 km far from Reguisheim');
}

/**
* @test
* @expectedException Exception
*/
public function should_notice_deprecation()
{
set_error_handler(function() {throw new \Exception; }, E_USER_DEPRECATED);
new \Knp\DoctrineBehaviors\ORM\Geocodable\GeocodableListener;
}

public function tearDown()
{
restore_error_handler();
}
}
15 changes: 15 additions & 0 deletions tests/Knp/DoctrineBehaviors/ORM/LoggableTest.php
Expand Up @@ -124,4 +124,19 @@ public function should_log_removal_message_when_deleted()
'BehaviorFixtures\ORM\LoggableEntity #1 removed'
);
}

/**
* @test
* @expectedException Exception
*/
public function should_notice_deprecation()
{
set_error_handler(function() {throw new \Exception; }, E_USER_DEPRECATED);
new \Knp\DoctrineBehaviors\ORM\Loggable\LoggableListener;
}

public function tearDown()
{
restore_error_handler();
}
}
15 changes: 15 additions & 0 deletions tests/Knp/DoctrineBehaviors/ORM/SluggableTest.php
Expand Up @@ -100,4 +100,19 @@ public function testUpdatedSlug()

$this->assertEquals($entity->getSlug(), $expected);
}

/**
* @test
* @expectedException Exception
*/
public function should_notice_deprecation()
{
set_error_handler(function() {throw new \Exception; }, E_USER_DEPRECATED);
new \Knp\DoctrineBehaviors\ORM\Sluggable\SluggableListener;
}

public function tearDown()
{
restore_error_handler();
}
}
15 changes: 15 additions & 0 deletions tests/Knp/DoctrineBehaviors/ORM/SoftDeletableTest.php
Expand Up @@ -103,4 +103,19 @@ public function testDeleteInheritance()

$this->assertTrue($entity->isDeleted());
}

/**
* @test
* @expectedException Exception
*/
public function should_notice_deprecation()
{
set_error_handler(function() {throw new \Exception; }, E_USER_DEPRECATED);
new \Knp\DoctrineBehaviors\ORM\SoftDeletable\SoftDeletableListener;
}

public function tearDown()
{
restore_error_handler();
}
}
15 changes: 15 additions & 0 deletions tests/Knp/DoctrineBehaviors/ORM/TimestampableTest.php
Expand Up @@ -161,4 +161,19 @@ public function it_should_modify_update_datetime_only_once()
'Update timestamp has changed'
);
}

/**
* @test
* @expectedException Exception
*/
public function should_notice_deprecation()
{
set_error_handler(function() {throw new \Exception; }, E_USER_DEPRECATED);
new \Knp\DoctrineBehaviors\ORM\Timestampable\TimestampableListener;
}

public function tearDown()
{
restore_error_handler();
}
}
15 changes: 15 additions & 0 deletions tests/Knp/DoctrineBehaviors/ORM/TranslatableTest.php
Expand Up @@ -180,4 +180,19 @@ public function should_remove_translation()
$em->refresh($entity);
$this->assertNotEquals('Hallo', $entity->translate('nl')->getTitle());
}

/**
* @test
* @expectedException Exception
*/
public function should_notice_deprecation()
{
set_error_handler(function() {throw new \Exception; }, E_USER_DEPRECATED);
new \Knp\DoctrineBehaviors\ORM\Translatable\TranslatableListener;
}

public function tearDown()
{
restore_error_handler();
}
}

0 comments on commit ac15c99

Please sign in to comment.