diff --git a/lib/internal/Magento/Framework/App/Resource.php b/lib/internal/Magento/Framework/App/Resource.php index faf59ba520b3e83dd5dfc8e63e12b83c9c89ffb3..fae3cdb761c5fc502aef804db2f7b59f492ef335 100644 --- a/lib/internal/Magento/Framework/App/Resource.php +++ b/lib/internal/Magento/Framework/App/Resource.php @@ -160,7 +160,6 @@ class Resource * @param string $time Either "before" or "after" * @param string $event The DB level event which activates the trigger, i.e. "update" or "insert" * @return string - * @codeCoverageIgnore */ public function getTriggerName($tableName, $time, $event) { diff --git a/lib/internal/Magento/Framework/App/Test/Unit/ResourceTest.php b/lib/internal/Magento/Framework/App/Test/Unit/ResourceTest.php index a92a9eb73432db63d22a8b28c104da5ec28360f4..86fc5bf7ac92bcbd89d423311a0fd3fc9be8cfbe 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/ResourceTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/ResourceTest.php @@ -14,7 +14,7 @@ use Magento\Framework\Config\ConfigOptionsListConstants; class ResourceTest extends \PHPUnit_Framework_TestCase { const RESOURCE_NAME = \Magento\Framework\App\Resource::DEFAULT_READ_RESOURCE; - const CONNECTION_NAME = 'Connection Name'; + const CONNECTION_NAME = 'connection-name'; const TABLE_PREFIX = 'prefix_'; /** @@ -197,4 +197,21 @@ class ResourceTest extends \PHPUnit_Framework_TestCase $this->assertEquals('fkName', $this->resource->getFkName($table, $columnName, $refTable, $refColumnName)); } + + public function testGetTriggerName() + { + $tableName = 'subject_table'; + $time = 'before'; + $event = 'insert'; + $triggerName = 'trg_subject_table_before_insert'; + + $this->_connectionFactory->expects($this->once()) + ->method('create') + ->will($this->returnValue($this->connection)); + $this->connection->expects($this->once()) + ->method('getTriggerName') + ->with($tableName, $time, $event) + ->willReturn($triggerName); + $this->assertSame($triggerName, $this->resource->getTriggerName($tableName, $time, $event)); + } }