Sonata\Test\Component\Generator\MysqlReferenceTest::testInvoice PHP Method

testInvoice() public method

public testInvoice ( )
    public function testInvoice()
    {
        $invoice = new InvoiceMock();
        $mysqlReference = $this->generateNewObject();
        try {
            $mysqlReference->invoice($invoice);
            $this->fail('->invoice() call should raise a \\RuntimeException for a new entity');
        } catch (\Exception $e) {
            $this->assertInstanceOf('\\RuntimeException', $e);
        }
        $invoice->setId(12);
        try {
            $this->assertNull($mysqlReference->invoice($invoice));
        } catch (\Exception $e) {
            $this->fail('->invoice() should return a NULL value but should now throw an \\Exception');
        }
    }