Sokil\Mongo\DocumentEventTest::testCancelledEventHandlerNotPropageted PHP Метод

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

    public function testCancelledEventHandlerNotPropageted()
    {
        $testCase = $this;
        $status = new \stdClass();
        $status->done = false;
        $this->collection->createDocument()->onBeforeInsert(function (\Sokil\Mongo\Event $event, $eventName, $dispatcher) use($status) {
            $status->done = true;
            $event->cancel();
        })->onBeforeInsert(function (\Sokil\Mongo\Event $event, $eventName, $dispatcher) use($testCase) {
            $testCase->fail('Event propagation not stoped on event handling cancel');
        })->save();
        $this->assertTrue($status->done);
    }