Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

start implementing ORM Route tests #429

Open
wants to merge 3 commits into
base: 2.1
Choose a base branch
from
Open

Conversation

ElectricMaxxx
Copy link
Member

@ElectricMaxxx ElectricMaxxx commented Dec 10, 2018

I'd like to hadd some ORM functionoal base tests?

@ElectricMaxxx ElectricMaxxx changed the title start implementing ORM Route start implementing ORM Route tests Dec 10, 2018
@ElectricMaxxx
Copy link
Member Author

I think the tests for ORM routes are running now, but they are red, caus we or at least i have an issue in my head here with staticPrefix and path. That pattern works for the route repository, but not with the ObjectManager. With the current way to persist routes in our tests we end up with routes in tests like

staticPrefix = /test/testroute`
path = '/'

when doing smth. like

        preg_match('{^(.*?)(/[^/]*\{.*)?$}', $path, $paths);

        $route = new Route($options);
        $route->setName($name);
        $route->setStaticPrefix($paths[1]);
        if (isset($paths[2])) {
            $route->setVariablePattern($paths[2]);
        }
        $this->getDm()->persist($route);
        $this->getDm()->flush();
        $this->getDm()->clear();

When i call OM->find(Route::class, '/test/testroute') now i got null, which is quite normal as the `path = /'.

No idea how it had been thought. But when comparing it with the tests of phpcr i would expect that the path is genereated out of staticPrefix and optional variablePattern or has to be set directly. So the path would be like the path in PHPCR and we can ask OM for it by its path, isn't it?

@ElectricMaxxx
Copy link
Member Author

Ahhh .. now it becomes clearer: At the end we do not have a path property mapped to our ORM model. It is a setter/getter living in Symfony route model.

So we would use staticPrefix at all?

Shouldn't we use a path also? for easier querying? or not?

@ElectricMaxxx
Copy link
Member Author

Now it becomes clearer. When asking for staticPrefix as done in RouteProvider, which i do not like to use in that functional test, i get my routes. But we do have a quite different behavior then in PHPCR world.

  • route content is not managed at all
  • variable pattern with our without / at the beginning
  • some listeners, which do not fetch falsy prefixes here

@ElectricMaxxx
Copy link
Member Author

@dbu you found some time to have a look in this one here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant