Codeception\Module\WPQueriesTest::it_should_allow_asserting_queries_by_class_method_and_statement PHP Метод

it_should_allow_asserting_queries_by_class_method_and_statement() публичный Метод

    public function it_should_allow_asserting_queries_by_class_method_and_statement()
    {
        $this->wpdb->queries = [['INSERT INTO ... (SELECT * ...)', 'some ms timing', 'a stack trace including Acme\\MyPlugin->methodOne'], ['SELECT ID FROM ... (SELECT...)', 'some ms timing', 'a stack trace including Acme\\MyPlugin->methodTwo'], ['SELECT * FROM ... INSERT', 'some ms timing', 'a stack trace including Acme\\MyPlugin->methodTwo'], ['UPDATE some_table... (SELECT', 'some ms timing', 'a stack trace including Acme\\MyPlugin->methodThree']];
        $sut = $this->make_instance();
        $sut->assertQueriesByStatementAndMethod('INSERT', 'Acme\\MyPlugin', 'methodOne');
        $sut->assertQueriesCountByStatementAndMethod(2, 'SELECT', 'Acme\\MyPlugin', 'methodTwo');
        $sut->assertNotQueriesByStatementAndMethod('UPDATE', 'Acme\\MyPlugin', 'methodOne');
        $this->expectException('PHPUnit_Framework_AssertionFailedError');
        $sut->assertQueriesByStatementAndMethod('UPDATE', 'Acme\\MyPlugin', 'methodOne');
        $this->expectException('PHPUnit_Framework_AssertionFailedError');
        $sut->assertQueriesCountByStatementAndMethod(3, 'UPDATE', 'Acme\\MyPlugin', 'methodThree');
        $this->expectException('PHPUnit_Framework_AssertionFailedError');
        $sut->assertNotQueriesByStatementAndMethod('SELECT', 'Acme\\MyPlugin', 'methodOne');
    }